RFR: 8291360: Create entry points to expose low-level class file information [v2]
David Holmes
dholmes at openjdk.org
Tue Aug 2 06:41:27 UTC 2022
On Mon, 1 Aug 2022 13:26:29 GMT, Harold Seigel <hseigel at openjdk.org> wrote:
>> src/java.base/share/classes/java/lang/Class.java line 4698:
>>
>>> 4696: *
>>> 4697: * If the class is an array type then the access flags of the component type is
>>> 4698: * returned. If the class is a primitive then ACC_ABSTRACT | ACC_FINAL | ACC_PUBLIC.
>>
>> The `ACC_ABSTRACT` seems odd - is that way of indicating this "class" can't be instantiated? Is there some spec document that explains this choice?
>
> I don't know why API's such as JVM_GetClassModifiers() and JVM_GetClassAccessFlags return ACC_ABSTRACT | ACC_FINAL | ACC_PUBLIC for primitives. Nor could I find a spec that discussed access flags for primitives. But, I didn't want to change what's been returned for primitives in existing code.
Interesting. `Class.getModifiers()` does not specify `ACC_ABSTRACT` so this seems to be something implementation specific (although no doubt a long standing situation.)
>> test/hotspot/jtreg/runtime/ClassFile/ClassFileVersionTest.java line 55:
>>
>>> 53:
>>> 54: testIt("Version64", 64);
>>> 55: testIt("Version59", 59);
>>
>> Any particular reason to choose 59? Shouldn't there also be tests for non-zero minor versions?
>
> No particular reason for choosing 59 other than it's different and less than 64. Test case Version64_65535 has a non-zero minor version.
I think we should be testing for other real classfile versions that may be encountered, such as 45.3
-------------
PR: https://git.openjdk.org/jdk/pull/9688
More information about the build-dev
mailing list