JEP draft: Better-defined JVM class file validation

Harold Seigel harold.seigel at
Fri Jun 11 18:38:58 UTC 2021

Hi Dan,


        Rejecting non-static field declarations
        with|ConstantValue|attributes, similarly on the basis that if
        the attribute appears in the|attributes|table of
        a|field_info|structure, it should be recognized and checked.

I tried implementing the above change and encountered errors when 
building the JDK because ConstantValue attributes were generated by 
javac for private final fields that were not static.  For example, these 
fields in had 
ConstantValue attributes:

             private final int BUILDER_VAR    = 0;
             private final int MD_VAR         = 1;  // variable for
             private final int MT_VAR         = 1;  // variable for
             private final int MH_VAR         = 1;  // variable for

There were a few other additional cases such as field MAX_FLATER in and NUM_COMMON_CPOOL_ENTRIES in

Should  the above check be class file version dependent?

Thanks, Harold

On 6/4/2021 12:41 PM, Dan Smith wrote:
> Posted a new JEP draft, here:
> This is some preparatory work to allow us to more cleanly introduce the variety of new JVM features coming with primitive objects (JEP 401).
> Most of the spec work is already done; you can browse the proposed spec changes here:

More information about the valhalla-spec-observers mailing list