java.lang.classfile model enumeration order

Adam Sotona adam.sotona at oracle.com
Fri Nov 22 10:42:52 UTC 2024


Hi Mark,
Fields and methods are included in the ClassElement stream or iterator in the same order, and this order corresponds to their order in the class file.
This principle is common for the whole API, except for some PseudoInstructions identifying their start and stop positions  in the stream by Labels. These PseudoInstructions are always streamed before respective LabelTargets.

Adam

From: classfile-api-dev <classfile-api-dev-retn at openjdk.org> on behalf of Mark Roberts <markro at cs.washington.edu>
Date: Friday, 22 November 2024 at 1:12
To: Chen Liang <chen.l.liang at oracle.com>, classfile-api-dev at openjdk.org <classfile-api-dev at openjdk.org>
Subject: java.lang.classfile model enumeration order
Are there any rules/guarantees that the order of items in ClassModel::methods() will match the order in ‘for (ClassElement ce : cm)’  for the ce elements that are MethodModel?  And also for similar items down the class hierarchy?

Thank you, Mark

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


More information about the classfile-api-dev mailing list