[External] : how does one get value of ConstantValueAttribute?

Mark Roberts markro at cs.washington.edu
Mon Nov 25 22:44:43 UTC 2024


Sorry – typo:  ‘constant()’



*From:* Chen Liang <chen.l.liang at oracle.com>
*Sent:* Monday, November 25, 2024 2:35 PM
*To:* Mark Roberts <markro at cs.washington.edu>; classfile-api-dev at openjdk.org
*Subject:* Re: [External] : how does one get value of
ConstantValueAttribute?



Hi Mark,

I don't understand your question.  Nowhere in any document mentions there's
a "const" in ConstantValueAttribute.  Its Javadoc is available here:

https://download.java.net/java/early_access/jdk24/docs/api/java.base/java/lang/classfile/attribute/ConstantValueAttribute.html

So once you get a ConstantValueAttribute from a field, you can check its
constant() accessor, and pattern match to check if it is an
IntegerEntry/StringEntry etc.



Regards,

Chen Liang
------------------------------

*From:* Mark Roberts <markro at cs.washington.edu>
*Sent:* Monday, November 25, 2024 4:17 PM
*To:* Chen Liang <chen.l.liang at oracle.com>; classfile-api-dev at openjdk.org <
classfile-api-dev at openjdk.org>
*Subject:* [External] : how does one get value of ConstantValueAttribute?



ConstantValueAttribute:const() is not public.  The documentation implies it
is.  How do you get the value?



Thanks,

Mark
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/classfile-api-dev/attachments/20241125/f5af50cf/attachment.htm>


More information about the classfile-api-dev mailing list