JEP draft: Better-defined JVM class file validation
harold.seigel at oracle.com
Fri Jun 11 18:38:58 UTC 2021
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 jdk.tools.jlink.internal.plugins.SystemModulesPlugin had
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
ZipFileSystem.java and NUM_COMMON_CPOOL_ENTRIES in AccessorGenerator.java.
Should the above check be class file version dependent?
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