JDK-8355536 : Create version constants to model preview language and vm features
  • Type: Enhancement
  • Component: core-libs
  • Sub-Component: javax.lang.model
  • Affected Version: 24
  • Priority: P3
  • Status: Open
  • Resolution: Unresolved
  • Submitted: 2025-04-24
  • Updated: 2025-08-14
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
tbdUnresolved
Related Reports
Blocks :  
CSR :  
Description
For both javax.lang.model.SourceVersion and java.lang.reflect.ClassFileFormatVersion, there is a need to represent the preview features when we query the version-specific methods.

While currently, there is no preview feature that cause such queries to differ from the latest version, when project valhalla delivers Value Classes (Preview) JEP, we anticipate to see a spike in such demands. As a result, we should prepare such an infrastructure before it arrives. 
Comments
Changing subcomponent to javax.lang.model to help with future JCP maintenance review (alternatively, the javax.lang.model changes could be done under a separate bug id).
05-05-2025

A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jdk/pull/25017 Date: 2025-05-02 22:55:09 +0000
05-05-2025

Given the nature of how the platform supports the concept of preview -- namely that there is only one preview for the current release; the preview features from previous releases strictly and explicitly outside of the model -- informs how preview-ness is modeled in these APIs. Specifically, I recommend that there be a single PREVIEW constant where values for new releases get inserted before the PREVIEW constant; example for SourceVersion going from release N to release (N+1): ... RELEASE_25, ... RELEASE_$N, RELEASE_PREVIEW, ; to ... RELEASE_25, ... RELEASE_$N, RELEASE_$(N+1), RELEASE_PREVIEW, ; The latest() and latestSupported() method should only returned numbered release values and _not_ the preview one.
24-04-2025