public inbox for kawa@sourceware.org
 help / color / mirror / Atom feed
From: Jamison Hope <jhope@alum.mit.edu>
To: kawa@sourceware.org
Subject: define-simple-class fields with ConstantValue attribute?
Date: Mon, 1 Jun 2020 14:16:00 -0400	[thread overview]
Message-ID: <CA+ghDQ8qrUCJ2BhXB3z4r_3ARkE6rS6+kaRPQj2km5cPA+VWVA@mail.gmail.com> (raw)

Is there a field initialization syntax for define-simple-class which
will cause the field to have a ConstantValue attribute set?

For example, if Test.java contains:

public class Test {
  public static final int X = 3;
}

then Test.class will have:

Field name: X public static final Signature: int
Attribute "ConstantValue", length:2, value: Integer 3

However, the equivalent (I believe) Kawa:

(define-simple-class Test () (X ::int allocation: 'static access:
'final init-form: 3))

produces:

Field name: X public static final Signature: int

without the ConstantValue attribute, and instead fills in the value
via code in clinit:

Method name:"<clinit>" public static Signature: ()void
Attribute "Code", length:29, max_stack:1, max_locals:0, code_length:5
  0: iconst_3
  1: putstatic <Field Test.X int>
  4: return

I also tried init: and init-value: and they didn't make a difference.

Thanks,

-- 
Jamison Hope

             reply	other threads:[~2020-06-01 18:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-01 18:16 Jamison Hope [this message]
2020-06-02  5:10 ` Per Bothner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CA+ghDQ8qrUCJ2BhXB3z4r_3ARkE6rS6+kaRPQj2km5cPA+VWVA@mail.gmail.com \
    --to=jhope@alum.mit.edu \
    --cc=kawa@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).