JDK-8364095 : [lworld] AccessFlags location and release need futher work for Valhalla (IDENTITY and SUPER)
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.lang:reflect
  • Affected Version: repo-valhalla
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2025-07-25
  • Updated: 2025-09-03
  • Resolved: 2025-09-03
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
repo-valhallaFixed
Related Reports
Blocks :  
Relates :  
Description
The jdk-25+21 merge brought in JDK-8297271 "AccessFlag.maskToAccessFlags should be specific to class file version"

Valhalla appears to have some further work to do here. Current state:

1) jdk/classfile/AdvancedTransformationsTest.java fails with: "java.lang.IllegalArgumentException: Unmatched bit position 0x20 for location INNER_CLASS"

2) tools/javap/T4975569.java fails with: "Error: Access Flags: Unmatched bit position 0x20 for location INNER_CLASS"

Problem listings these for now.

AccessFlag.java appears to contain some discrepancies when it comes to inner class allowing SUPER. It appears Valhalla uses SUPER in SET_CLASS_INNER_CLASS (location set), but that is not so in mainline. Doesn't mention in super in inner class in JEP401 (just IDENTITY, which of course == ACC_SUPER).

INNER_CLASS was declared with IDENTITY or SUPER, was tweaked back (during merge) to "if preview() then IDENTITY" (not "else SUPER"). Otherwise java/lang/reflect/AccessFlag/VersionedLocationsTest.java  would fail.

It appears java/lang/reflect/AccessFlag/VersionedLocationsTest.java needs to be run with and without @enablePreview.

I don't believe the current version checking uses minor (aka preview), so it is difficult to map IDENTITY with "latest version + preview" vs "latest version". So correctly allowing IDENTITY for preview but not previous releases is not currently possible

...it is entirely possible further (yet merged) changes resolve some of this ?
Comments
A pull request was submitted for review. Branch: lworld URL: https://git.openjdk.org/valhalla/pull/1533 Date: 2025-08-25 22:00:06 +0000
28-08-2025

I had proposed JDK-8355536 to mainline to address this requirement of representing and accessing preview-specific reflective information; however no one seems interested in reviewing that :(
28-07-2025

Since there was so much noise, I've restored ACC_SUPER to INNER_CLASS , merged 8358078 and undo the problem listings for jdk/classfile/AdvancedTransformationsTest.java and tools/javap/T4975569.java Problem listed: * java/lang/reflect/AccessFlag/BasicAccessFlagTest.java#BasicPreview * java/lang/reflect/AccessFlag/VersionedLocationsTest.java
28-07-2025

java/lang/reflect/AccessFlag/BasicAccessFlagTest.java fails with "Unmatched bit position 0x20 for location INNER_CLASS for class file format RELEASE_0" during merge of jdk-25+22 (problem listing). Wonder if we consider waiting with this bug until merge work is more up to date. Finds further issues with 8297271, fixed in 8358078. Yet using "ClassFileFormatVersion.fromMajor(major)", e.g. in "ClassWriter.cffv()" still seems suspicious, i.e. we are stripping off preview ?
28-07-2025