On Fri, 29 Jul 2022 18:02:46 GMT, Harold Seigel <hsei...@openjdk.org> wrote:

> Please review this change to fix JDK-8291360.  This fix adds entry points 
> getClassFileVersion() and getClassAccessFlagsRaw() to class java.lang.Class.  
> The new entry points return the current class's class file version and its 
> raw access flags.
> 
> The fix was tested by running Mach5 tiers 1-2 on Linux, Mac OS, and Windows, 
> and Mach5 tiers 1-3 on Linux x64.  Additionally, the JCK lang, vm, and api 
> tests and new regression tests were run locally on Linux x64.
> 
> Thanks, Harold

src/hotspot/share/prims/jvm.cpp line 4059:

> 4057:     return JVM_CLASSFILE_MAJOR_VERSION;
> 4058:   }
> 4059:   assert(!java_lang_Class::as_Klass(mirror)->is_array_klass(), 
> "unexpected array class");

Can this throw IllegalArgumentException instead.
Asserts only report problems when built with debug (Right?)

test/hotspot/jtreg/runtime/ClassFile/ClassAccessFlagsRawTest.java line 59:

> 57:         // test primitive array.  should return ACC_ABSTRACT | ACC_FINAL 
> | ACC_PUBLIC.
> 58:         int flags = (int)m.invoke((new int[3]).getClass());
> 59:         if (flags != 1041) {

Can this be a hex constant, It's easier to understand the bits.
Or assemble the flags from java.lang.reflect.Modifier.XXX static fields.

test/hotspot/jtreg/runtime/ClassFile/classAccessFlagsRaw.jcod line 25:

> 23:  */
> 24: 
> 25: // Class with ACC_SUPER set

Can these classes be defined more succinctly either in Java or .asm?

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

PR: https://git.openjdk.org/jdk/pull/9688

Reply via email to