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

Chen Liang chen.l.liang at oracle.com
Mon Nov 25 22:34:45 UTC 2024


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/28c92009/attachment-0001.htm>


More information about the classfile-api-dev mailing list