JEP 12: Preview Language and VM Features - possible usage testimony

562 views Asked by At

I bumped into JEP 12 searching for JDK 12 and was intrigued.

Summary: A preview language or VM feature is a new feature of the Java SE Platform that is fully specified, fully implemented, and yet impermanent. It is available in a JDK feature release to provoke developer feedback based on real world use; this may lead to it becoming permanent in a future Java SE Platform.

Following the responses to this question, I wish to ask only the following:

  • Can you provide a usage example of this JEP- incorporation of new language and/or VM features in code?
1

There are 1 answers

0
Stephen C On BEST ANSWER

Does this mean that usage of new features will now be as simple as downloading a support jar and 'plugging' it into our projects?

No. This is about enabling "preview" features in the Java language and the JVM, so that a feature can gain wider exposure and feedback (with suitable opt-ins) before being finalized. (If you could just enable an experimental / preview feature by dropping in a JAR file, this mechanism wouldn't be necessary ...)

In fact, with the "preview" mechanism as described in the JEP:

  • any code supporting a preview feature would already part of the JRE / JDK, and
  • the features would be enabled by providing extra command line options to the javac and java commands.

Can anyone share any usage experiences of this JEP? Actual code?

Compiler and VM support for preview features will be supported starting in Java 11, and we will likely see the first preview features in Java 12. Looking at the early access build release notes, they don't explicitly mention any "preview" features. Yet.

It is too soon for "experiences". (And I'm not sure what they would tell you. The JEP-12 mechanism is the mechanism for enabling the features ... not the features themselves.)

I also looked into the JIRA issue related to this JEP, it seems that this feature is currently completed but unresolved.

The issue is an "umbrella" issue (if that is the correct term). Drill down to the list of related issues, and you will see that two of them are still unresolved. However three related issues are resolved, so it looks like JEP-12 support will make it into Java 11.

UPDATE: 2019/08/22 - There is now just one relatively small issue about improving javac compiler messages.