are CodeElements unique?
Paul Sandoz
paul.sandoz at oracle.com
Wed May 7 17:59:49 UTC 2025
Yes. All code items have identity, and their equals/hashCode is defined in terms of that identity i.e., same implementation as for Object.
A reflected method body or lambda body must have only one code model instance associated with it. (We have been fixing some a bugs to ensure this is guaranteed.)
Paul.
On May 7, 2025, at 10:43 AM, Mark Roberts <markro at cs.washington.edu> wrote:
Are the members of a CodeModel.elementList() unique? Specifically, is it safe to use a CodeElement as the key value in a Map?
Thank you,
Mark
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/classfile-api-dev/attachments/20250507/04d1ab32/attachment.htm>
More information about the classfile-api-dev
mailing list