---
spec: JLS
title: "The Java Language Specification"
edition: "Java SE 15 Edition"
java_version: 15
chapter: "Chapter 1. Introduction"
section: "1.5"
heading: "1.5. Preview Features"
parent: "Chapter 1. Introduction"
source: https://docs.oracle.com/javase/specs/jls/se15/html/jls-1.html#jls-1.5
id: "1.5"
url: https://jvm.obfuscated.software/jls/se15/1.5.html
raw: https://jvm.obfuscated.software/jls/se15/1.5.md
---

# 1.5. Preview Features

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

Implementations must disable, at both compile time and run time, the preview features defined by a given release of the Java SE Platform, unless the user indicates via the host system, at both compile time and run time, that preview features are to be enabled.

The preview features defined by a given release of the Java SE Platform are specified in standalone documents that indicate changes ("diffs") to *The Java® Language Specification* for that release. The specifications of preview features are incorporated into *The Java® Language Specification* by reference, and made a part thereof, if and only if preview features are enabled at compile time.

Java SE 15 defines three preview features in the Java programming language: *Pattern Matching for `instanceof`*; *Records*; and *Sealed Classes*. The standalone documents which specify these preview features are available at the Oracle web site which hosts *The Java® Language Specification*: [`https://docs.oracle.com/javase/specs/`](https://docs.oracle.com/javase/specs/).

A preview feature may be associated with elements of the Java SE Platform API. Namely, an API element is *essential* if it exists in the package `java.lang` or `java.lang.annotation`, and programs cannot use the preview feature without referring (directly or indirectly) to the API element.

If preview features are disabled, then a compile-time error occurs if an essential API element is used (overridden, invoked, or referenced by name) in the declaration of a program element (whether explicitly or implicitly declared).

If preview features are enabled, then a Java compiler must produce a *preview warning* if an essential API element is used (overridden, invoked, or referenced by name) in the declaration of a program element (whether explicitly or implicitly declared), unless:

- The use is within a declaration that is itself an essential API element; or
- The use is within a declaration that is annotated to suppress preview warnings ([§9.6.4.5](9.6.4.5.md)); or
- The declaration where the use appears and the declaration of the essential API element are both within the same outermost class; or
- The use is within an `import` declaration that imports the essential API element.

Java SE 15 contain the following essential API elements:

- For the preview feature *Records*: The class `Record`; and in enum `java.lang.annotation.ElementType`, the enum constant `RECORD_COMPONENT`.
