Draft JEP: Incubating Language and VM Features
forax at univ-mlv.fr
Fri Jan 19 23:39:11 UTC 2018
I like the whole idea, solving the problem of new features not being enough tested is a good idea but the the way the experimental flag is set is like asking for trouble.
The JEP goes into a great length to say that we only need a bit of information to mark a classfile as experimental, then explain that the way to set this experimental bit is to change semantics of the classfile version i.e. current classfile versions that support jdk 10 are the version <= 0x00360000 and it will becomes the version <= 0x0036ffff.
In section 4.1 of the JVMS,
Oracle's Java Virtual Machine implementation in JDK release 1.0.2 supports class file format versions 45.0 through 45.3 inclusive. JDK releases 1.1.* support class file format versions in the range 45.0 through 45.65535 inclusive. For k ≥ 2, JDK release 1.k supports class file format versions in the range 45.0 through 44+k.0 inclusive.
has to be changed to
Oracle's Java Virtual Machine implementation in JDK release 1.0.2 supports class file format versions 45.0 through 45.3 inclusive. JDK releases 1.1.* support class file format versions in the range 45.0 through 45.65535 inclusive. For 2 <= k >= 10, JDK release 1.k supports class file format versions in the range 45.0 through 44+k.0 inclusive. for k >= 11, JDK release 1.k supports class file format versions in the range 55.0 through 44+k.65535
Changing the semantics of the classfile version means changing all the libraries that deals with bytecode but more importantly, it also means changing all the tools that use these libraries because usually the semantics is not used by the bytecode libraries but by the code that use them.
Furthermore, the text of the JEP says that no access flags are available, this is not true,
here are the access_flags defined (again section 4.1 of the JVMS)
ACC_PUBLIC 0x0001 Declared public; may be accessed from outside its package.
ACC_FINAL 0x0010 Declared final; no subclasses allowed.
ACC_SUPER 0x0020 Treat superclass methods specially when invoked by the invokespecial instruction.
ACC_INTERFACE 0x0200 Is an interface, not a class.
ACC_ABSTRACT 0x0400 Declared abstract; must not be instantiated.
ACC_SYNTHETIC 0x1000 Declared synthetic; not present in the source code.
ACC_ANNOTATION 0x2000 Declared as an annotation type.
ACC_ENUM 0x4000 Declared as an enum type.
ACC_MODULE 0x8000 Is a module, not a class or interface.
so 0x0002, 0x0004, 0x0008, 0x0040, 0x0080, 0x0100, 0x0800 are free, and you can also use combinations.
You can also add a new empty class attribute "Experimental" exactly like Deprecated is a class attribute,
we do not care about the size of the attribute given that the class is an experimental class, so 99.99..% of the classes will be marked experimental.
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.
----- Mail original -----
> De: "mark reinhold" <mark.reinhold at oracle.com>
> À: "Alex Buckley" <alex.buckley at oracle.com>
> Cc: "jdk-dev" <jdk-dev at openjdk.java.net>
> Envoyé: Vendredi 19 Janvier 2018 21:53:57
> Objet: Re: Draft JEP: Incubating Language and VM Features
> 2018/1/19 11:52:55 -0800, alex.buckley at oracle.com:
> Or, in an easier-to-read format:
> - Mark
More information about the jdk-dev