Ref. JEP 12 - Preview Language and VM Features

Alex Buckley alex.buckley at
Wed Mar 7 20:07:46 UTC 2018

On 3/7/2018 2:11 AM, Alan Bateman wrote:
> On 07/03/2018 01:49, Alex Buckley wrote:
>> On 3/6/2018 5:00 PM, David Holmes wrote:
>>> The JEP defines a "launcher flag" --enable-preview but it is unclear
>>> whether this is truly a launcher flag or a VM flag? Is the VM expected
>>> to process the --enable-preview flag and accept it via the JNI
>>> invocation API? Or does the launcher translate --enable-preview into a
>>> suitable -XX VM flag?
>>> If the above is considered too implementation oriented for the JEP then
>>> at a minimum the JEP needs to clarify whether you can enable preview
>>> features via the JNI invocation API.
>> Let's proceed by assuming that you cannot enable preview features via
>> the JNI Invocation API.
> I think it would be better to start with having it supported in the VM
> as the VM needs to act on it anyway. This avoids the need for the java
> launcher to do translation and makes it consistent for the corner case
> that is custom launchers using JNI CreateJavaVM. It would also be
> consistent with the runtime options that we added in JDK 9, these can
> all be specified via the JNI invocation API too.

The ability at run time to enable preview language/VM features is less 
"essential" than the ability to (say) redefine module declarations with 
additional exports. It's unnecessary to expand the JNI Invocation API to 
represent preview features in any kind of first-class way.

Moving on, I defer to your expertise if you think a VM flag is better 
than a launcher flag, such that the current JNI Invocation API can be 
used to enable preview features.


More information about the jdk-dev mailing list