RFR: 8355536: Model preview enabled VM features in ClassFileFormatVersion [v10]
Roger Riggs
rriggs at openjdk.org
Thu Feb 26 14:44:58 UTC 2026
On Thu, 26 Feb 2026 03:32:03 GMT, Chen Liang <liach at openjdk.org> wrote:
>> Sometimes, for version-specific feature access APIs, we wish to access the preview features of the current Java SE release. To reduce the impact of adding one preview-specific version on every site, we can add a constant modeling the preview features as a fake version.
>
> Chen Liang has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 18 commits:
>
> - Tweak test
> - More tweaks
> - Refresh
> - Merge branch 'master' of https://github.com/openjdk/jdk into feature/preview-cffv
> - Merge branch 'master' of https://github.com/openjdk/jdk into feature/preview-cffv
> - Fixes
> - Fix sourceversion test
> - Merge branch 'master' of https://github.com/openjdk/jdk into feature/preview-cffv
> - Merge branch 'master' of https://github.com/openjdk/jdk into feature/preview-cffv
> - Merge branch 'master' of https://github.com/openjdk/jdk into feature/preview-cffv
> - ... and 8 more: https://git.openjdk.org/jdk/compare/d6044d3e...8e128d29
src/java.base/share/classes/java/lang/reflect/ClassFileFormatVersion.java line 61:
> 59: /*
> 60: * Summary of class file format evolution; previews are listed for
> 61: * convenience, but they are not modeled by the RELEASE_ constants.
Suggestion:
* convenience, but they are not modeled by the {@code RELEASE_} constants.
Might be a bit more readable.
src/java.base/share/classes/java/lang/reflect/ClassFileFormatVersion.java line 418:
> 416: * This is a reflective preview API to allow tools running in Java runtime
> 417: * environments with no preview feature enabled to examine preview VM
> 418: * features, such as those present in {@code class} files.
I don't think class needs code font.
src/java.base/share/classes/java/lang/reflect/ClassFileFormatVersion.java line 500:
> 498: */
> 499: public Runtime.Version runtimeVersion() {
> 500: if (this == PREVIEW_ENABLED)
Since PREVIEW_ENABLED is for the current version wouldn't it return the same Version string as the running system?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/25017#discussion_r2859372408
PR Review Comment: https://git.openjdk.org/jdk/pull/25017#discussion_r2859391900
PR Review Comment: https://git.openjdk.org/jdk/pull/25017#discussion_r2859409739
More information about the core-libs-dev
mailing list