JDK-8233863 : 4.7: Simplify and clarify the rules for optional attribute validation
  • Type: Bug
  • Component: specification
  • Sub-Component: vm
  • Affected Version: 8
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • Submitted: 2019-11-08
  • Updated: 2024-10-16
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.
JDK 24
24Unresolved
Related Reports
Relates :  
Relates :  
Relates :  
Relates :  
Description
4.7 groups attributes into three categories. Only the first category is necessary for JVM semantics; the second and third are consumed by tools.

It is unclear exactly when and how attributes are validated in the first two categories (the third is accurately described as unvalidated), nor is it clear why an attribute would belong to the second rather than the third category, or vice versa.

Proposals:

- Do not waste computation and startup time validating attributes other than those that are necessary for JVM semantics. (This is a significant change to implementation behavior, with a potential compatibility impact on tools.)

- Clarify that the "static constraints" of 4.9.1 are used to validate most of Code and StackMapTable attributes. Simplify error checking by always throwing VerificationError at verification time.

- Cleaning up verification rules to avoid redundant checks (they can assume format checks and static constraints have been satisfied).

There are also some bugs in the verification rules of field and method references that should be addressed (the receiver type may be an array type; invokespecial and invokestatic support interface methods).
Comments
Once JDK-8233854 has been resolved, the only remaining specification change is to 4.7, as follows: - For "The predefined attributes are categorized into three groups according to their purpose", replace "three" with "two", and delete the second group - Add the 10 now-unmentioned attributes to the third (now second) group The changes from JDK-8233854 already explain that, for attributes in this group, "A class file may be invalid (4) if a recognized attribute from this list appears an unsupported number of times in some attributes table, as specified in this section. Otherwise, the length and contents of the attribute has no effect on the validity of the class file." Separate changes to HotSpot, and perhaps the reflection libraries (performing additional validation), will need to accompany this change via a separate bug fix.
12-01-2024

Changes related to Code and StackMapTable validation (via verification) have been moved to JDK-8323550. The remaining concern for this bug is the treatment and validation of optional attributes.
12-01-2024

Proposed changes to 4.7, 4.9, and 4.10 are attached.
08-11-2019