RFR(XS) 8136632: VM format checking requires Code attribute from abstract/native non-initializer <clinit>

harold seigel harold.seigel at oracle.com
Tue Sep 29 13:49:15 UTC 2015


Hi,

Please review this small change to fix bug 8136632. Section 2.9 
<http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-2.html#jvms-2.9> 
of the JVM 8 Spec says:

    A class or interface has at most one /class or interface
    initialization method/ and is initialized (§5.5
    <http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-5.html#jvms-5.5>)
    by invoking that method. The initialization method of a class or
    interface has the special name |<clinit>|, takes no arguments, and
    is void (§4.3.3
    <http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.3.3>).


    Other methods named |<clinit>| in a |class| file are of no
    consequence. They are not class or interface initialization methods.
    They cannot be invoked by any Java Virtual Machine instruction and
    are never invoked by the Java Virtual Machine itself.

    In a |class| file whose version number is 51.0 or above, the method
    must additionally have its |ACC_STATIC| flag (§4.6
    <http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.6>)
    set in order to be the class or interface initialization method.

This fix avoids checking the access flags of methods named <clinit> if 
they take arguments and/or are not void because such methods are not 
class nor interface initialization methods.

Open webrev: http://cr.openjdk.java.net/~hseigel/bug_8136632/

JBS Bug: https://bugs.openjdk.java.net/browse/JDK-8136632

The fix was tested with JCK Lang, VM, and API java_lang tests, the UTE 
quick and split verifier tests, and the hotspot, JDK vm, java/io, 
java/lang, and java/util JTreg tests, the JCK tests that are currently 
excluded because of this bug, and the test cases in the bug report.

This scenario will be tested by JCK-9.  So there's no regression test in 
this webrev.

Thanks, Harold


More information about the hotspot-runtime-dev mailing list