JEP 12: JVM version constraints

Alex Buckley alex.buckley at oracle.com
Mon Mar 26 23:10:25 UTC 2018


On 3/5/2018 2:57 PM, Dan Smith wrote:
> JEP 12, in describing the treatment of "preview" class files,
> requires that:
>
>> A JVM implementation for Java SE $N must not define a class file
>> that depends on the preview VM features of another platform
>> version
>
> In other words, where SE 11 class files have major version 55, an SE
> 12 JVM must reject class files with version 55.65535.
>
> This is a change in JVM behavior—currently the spec says:
>
> "A Java Virtual Machine implementation can support a class file
> format of version v if and only if v lies in some contiguous range
> Mi.0 ≤ v ≤ Mj.m." (JVMS 4.1)
>
> Note the word "contiguous".

It's even worse than that. Imagine how SE 12 will present the table of 
contiguous ranges currently given for SE 10 at 
https://docs.oracle.com/javase/specs/jvms/se10/html/jvms-4.html#jvms-4.1-200-B 
:-

...
10   45.0 <= v <= 54.0
11   45.0 <= v <= 55.0
12   45.0 <= v <= 56.0

Not only does this mandate acceptance of a 55.65535 class file that an 
SE 12 JVM should never have to worry about, but it also forbids 
acceptance of a 56.65535 class file that hopes to use the preview 
features of SE 12!

> My two cents: we can carve out a really narrow range of prohibited
> version numbers (55.65535, 56.65535, ...). But I'd rather make a
> breaking change: enumerate all the actually-used version numbers
> since 1.0 (something like 45.*, 46.0, 47.0, ..., 55.0), and reject
> the rest.

In the time since you posted, there has been support on this list for 
rejecting non-zero minor versions, so enumerating actually-used versions 
is plausible. Bear in mind that preview features are part of Java SE, so 
the enumeration would be: (assuming preview features first surface in SE 11)

...
10   45.*, 46.0, 47.0, 48.0, 49.0, 50.0, 51.0, 52.0, 53.0, 54.0
11   45.*, 46.0, 47.0, 48.0, 49.0, 50.0, 51.0, 52.0, 53.0, 54.0, 55.0, 
55.65535
12   45.*, 46.0, 47.0, 48.0, 49.0, 50.0, 51.0, 52.0, 53.0, 54.0, 55.0, 
56.0, 56.65535

Please confirm that's what you were expecting.

Alex


More information about the jdk-dev mailing list