Incubator and Preview Features in OpenJDK
With the introduction of the six-months release cycle in the OpenJDK project in 2018 (since OpenJDK 10), the evolution of the Java programming language and runtimes is managed with incubator and preview features, introduced by JEP 12. These features are only available during compilation and runtime when additional flags are used, and can be used for experiments and to try out these new features. This way, the Java community helps to evaluate new evolutions, provide feedback to the developers, and discover problems and inconsistencies.
Difference Between Incubator and Preview
Incubator Feature
Incubator (or experimental) features are not mature yet but allow early adopters and enthusiasts to use them in experiments. You can expect them to be buggy or unstable as they need to further mature in the next releases. But they can even be removed again, based on the feedback and the evolution of their development.
Some examples:
Preview Feature
Preview features have been fully specified, developed, and implemented, but are still being evaluated and can further change. They can be used in development to experiment with upcoming new features and can be expected to become available in a future version, although this is still not guaranteed.
Some examples:
How to Use These Features
Conclusion
Incubator and preview features allow the Java-ecosystem to continuously evolve while getting feedback from the users about usability, consistency, and stability. You should never use these in production as they are not stable yet and can still evolve before they become generally available, or even get removed, in one of the next releases.