Press "Enter" to skip to content

Difference Between Preview, Experimental, and Incubating Features in Java

After Java’s release cycle got revolutionized, we can expect more and more changes coming to the language faster than in the past.

This is why we’re more likely to see JEPs/features annotated as Preview, Experimental, or Incubating, and in this article, we’ll have a look at differences between them (no code included).

Preview Features

The concept of a Preview Feature was introduced by JEP-12.

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.

Simply put, those are complete or almost complete language features ready to try out, think beta-testing.

Features are published as Preview, to collect feedback about them without committing to maintaining its backward compatibility – which means everyone is encouraged to try them out, but, at the same time, discouraged from using them in production.

On the other hand, these have a relatively short “grace-period” so you can expect them to mature fast.

Examples of such Preview features:

It’s worth noting that Preview features are not available out-of-the-box, in order to access them, one needs to use the –enable-preview compiler flag.

Experimental Features

Experimental features represent early versions of (mostly) VM-level features, which can be risky, incomplete, or even unstable. In most cases, they need to be enabled using dedicated flags.

For the purpose of comparison, if an experimental feature is considered 25% “done”, then a preview feature should be at least 95% “done”.

Examples of Experimental features:

In most cases, they require extra flags for turning them on.

Keep in mind that each vendor is free to enable/disable arbitrary experimental features in their distributions.

Incubating Features (or Incubator)

Incubating Features are experimental APIs distributed in a form of separate modules with names prefixed with “jdk.incubator.”.

Examples of Incubator features:

In order to access them, their modules need to be explicitly added.

Summary

As much as having three different names denoting the character of the change and how close it is to be complete, we need to remember that none of them are actually production-ready.




If you enjoyed the content, consider supporting the site: