On Wed, 11 Mar 2026 20:54:51 GMT, Chen Liang <[email protected]> wrote:
>> Currently, the preview access flag enum constants are made available with a >> ClassFileFormatVersion.CURRENT_PREVIEW_FEATURES constant. Such a constant is >> questionable design. >> >> We can have an approach to model preview access flags without such a >> constant, losing the ability for users to inspect through >> `ClassFileFormatVersion`, but otherwise keeping these interfaces intact: >> >> 1. `accessFlags()` factory methods in core reflection >> 2. Inspection of AccessFlag through ClassFile API >> 3. The outputs of javap >> >> The new design makes use of a new internal API, >> `jdk.internal.reflect.PreviewAccessFlags`. It replaces the AccessFlag APIs >> that previously took `ClassFileFormatVersion.CURRENT_PREVIEW_FEATURES`. This >> introduces a new qualified export from `java.base/jdk.internal.reflect` to >> `jdk.jdeps` for Javap usage. >> >> In addition, with the recent awareness that core reflection/HotSpot only has >> one unique representation of modifiers, we can remove some contrived >> representation of access flags present in mainline (that required pulling >> class version from Class mirrors) and migrate to our simplified system that >> decodes the uniform representation used by hotspot. > > Chen Liang has updated the pull request with a new target base due to a merge > or a rebase. The incremental webrev excludes the unrelated changes brought in > by the merge/rebase. The pull request contains eight additional commits since > the last revision: > > - Tweak related tests > - Review and test cleanup and inner class super > - Merge branch 'lworld' of https://github.com/openjdk/valhalla into > fix/lw-remove-cffv-preview > - Dead import > - Merge branch 'lworld' of https://github.com/openjdk/valhalla into > fix/lw-remove-cffv-preview > - Bugs and redundant diffs > - Silly test > - Remove PREVIEW class file format version and rewire stuff test/jdk/java/lang/reflect/AccessFlag/BasicAccessFlagTest.java line 1: > 1: /* This guy is back to the same as mainline test/jdk/java/lang/reflect/AccessFlag/ClassAccessFlagPreviewTest.java line 32: > 30: * @run main ClassAccessFlagPreviewTest > 31: * @enablePreview true > 32: * @compile -XDforcePreview ClassAccessFlagPreviewTest.java A x.65535 class file is not necessary for this test, as preview modifier representation happens whenever the whole VM is in preview test/jdk/java/lang/reflect/AccessFlag/VersionedLocationsTest.java line 1: > 1: /* This guy is back to the same as mainline ------------- PR Review Comment: https://git.openjdk.org/valhalla/pull/2209#discussion_r2921021830 PR Review Comment: https://git.openjdk.org/valhalla/pull/2209#discussion_r2921021355 PR Review Comment: https://git.openjdk.org/valhalla/pull/2209#discussion_r2921005093
