JDK-8233854 : 4.8: Clarify which checks occur during format checking
  • Type: Bug
  • Component: specification
  • Sub-Component: vm
  • Affected Version: 8
  • Priority: P4
  • Status: In Progress
  • Resolution: Unresolved
  • Submitted: 2019-11-08
  • Updated: 2024-06-13
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 :  
Relates :  
Relates :  
Relates :  
Description
JVMS 4.8 attempts to describe the validation that occurs on class file contents during class loading (under the umbrella of "format checking"), but its list of checks is incomplete.

A better approach is to identify *throughout* Chapter 4 the assertions about the class file format that constitute format checks. My suggested approach is to carefully use the word "must" in Chapter 4 iff a format check is being described.

Based on some testing of Hotspot behavior and desire to keep things simple, some suggested behavioral changes:

- Eliminating checks on CONSTANT_NameAndType structures involving restricted method names (names that include < or >) and name/descriptor coordination (4.4.6). These checks should only occur when the constant is referenced from a context that requires a method.

- Ensuring that a CONSTANT_InvokeDynamic structure never uses method name <init> (4.4.10), rather than delaying the check until an invokedynamic instruction is verified.

- Rejecting class or interface declarations with Module, ModulePackages, or ModuleMainClass attributes (4.7.25, 4.7.26, 4.7.27), and non-static field declarations with ConstantValue attributes (4.7.2).

Comments
Revised presentational changes are attached, and can be found at https://cr.openjdk.org/~dlsmith/8233854/8233854-20240111/specs/format-checking-jvms.html I'll probably do another round of reviewing/polishing this document before proceeding further.
12-01-2024

HotSpot conformance with the specified rules for NameAndType constants should be addressed by JDK-8322655.
22-12-2023

Created separate issues for the behavioral changes associated with module-related attributes (JDK-8322650) and ConstantValue (JDK-8322651).
21-12-2023

Proposed changes to 4.1-4.8 and 5.3.5 are attached.
08-11-2019