Draft JEP: Incubating Language and VM Features

John Rose john.r.rose at oracle.com
Sat Jan 20 00:24:03 UTC 2018

On Jan 19, 2018, at 3:39 PM, Remi Forax <forax at univ-mlv.fr> wrote:
> So let's all agree that this is nice JEP and that the way to mark a class experimental is to add an attribute Experimental to the classfile.

Remi, you are glossing over a big point here:  We are going to be experimenting
with constant pool formats.  You can't read the access_flags or any attributes
until you have parsed the constant pool.  It is unreasonable to parse the constant
pool before you know whether it is allowed to have experimental features in it.
This leaves the magic number, major and minor versions, and the CP length
itself as channels to carry the experimental bit.  Of those, the most reasonable
and intuitive is the minor version.

So it's the minor version.  Next question:  What bit pattern?  Best answer,
AFAIK is to reserve one bit and concentrate on that.  That leaves the other
minor version bits untouched and free for other uses.

Next question:  Does anybody actually *use* the minor version bits?  The
spec suggests they were in play once, but I have *never* seen anybody use
them to carry information in modern versions of Java.  If those 16 bits are
always zero, then clearly we can steal one of them.  And I think we have
both the habit and the right of declaring that they must be zero and are
reserved for future extensions, such as an experimental flag.

— John

P.S. In fact (separate conversation) I would like to reserve *another* minor
version bit to denote "private use plane", meaning that projects like
Valhalla can mark their prototype classfiles using the minor version
in such a way that there is guaranteed to be never any standard JVM
that will ever load those prototype classfiles.

More information about the jdk-dev mailing list