RFR: JDK-8317635: Improve GetClassFields test to verify correctness of field order [v2]

Alex Menkov amenkov at openjdk.org
Wed Oct 18 01:53:44 UTC 2023


On Thu, 12 Oct 2023 20:23:10 GMT, Alex Menkov <amenkov at openjdk.org> wrote:

>> test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassFields/getclfld007/TestDescription.java line 36:
>> 
>>> 34:  *     The test checks if the function returns the expected list of fields:
>>> 35:  *         - the list contains only directly declared (not inherited) fields;
>>> 36:  *         - fields are returned in the order they occur in the class file.
>> 
>> Is the order of the fields in the class file guaranteed to be the same as the declaration order?
>
> Good question.
> Javac works this way, but looks like this is not a requirement.
> Looks like the test should use some class file parser to get actual field order

Updated the test to get expected field order (as well as field name and type) from class file

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/16131#discussion_r1363009009


More information about the serviceability-dev mailing list