-
Bug
-
Resolution: Fixed
-
P4
-
9
2.9.2 specifies that a void method named <clinit> in a 51.0 class file must be static and no-args in order to be a class or interface initialization method. If the static test or the no-args test fails, then it is not a class or interface initialization method and should be rejected by 4.6. 4.6 performs the no-args test on descriptor_index (though fails to make it version-specific), but does not perform the static test on access_flags. Say:
- access_flags: "In a class file whose version number is 51.0 or above, a method whose name is <clinit> must have its ACC_STATIC flag set (§2.9.2)."
- descriptor_index: "If the name of the method is <clinit>, then the descriptor must denote a void method, and, in a class file whose version number is 51.0 or above, a method that takes no arguments."
Returning to access_flags, the paragraph about the JVM ignoring the flags of a "successful" <clinit> method (i.e. one which meets the reqs for a class or interface initialization method) should be less strident. Saying that all access_flags are "ignored" except for ACC_STRICT is improper, because the static-ness of the method is important to verification and execution. Say:
"A class or interface initialization method (§2.9.2) is called implicitly by the Java Virtual Machine. The value of its access_flags item is ignored except for the setting of the ACC_STATIC and ACC_STRICT flags, and the method is exempt from the preceding rules about legal combinations of flags."
- access_flags: "In a class file whose version number is 51.0 or above, a method whose name is <clinit> must have its ACC_STATIC flag set (§2.9.2)."
- descriptor_index: "If the name of the method is <clinit>, then the descriptor must denote a void method, and, in a class file whose version number is 51.0 or above, a method that takes no arguments."
Returning to access_flags, the paragraph about the JVM ignoring the flags of a "successful" <clinit> method (i.e. one which meets the reqs for a class or interface initialization method) should be less strident. Saying that all access_flags are "ignored" except for ACC_STRICT is improper, because the static-ness of the method is important to verification and execution. Say:
"A class or interface initialization method (§2.9.2) is called implicitly by the Java Virtual Machine. The value of its access_flags item is ignored except for the setting of the ACC_STATIC and ACC_STRICT flags, and the method is exempt from the preceding rules about legal combinations of flags."
- relates to
-
JDK-8130682 2.9: Clarify class and interface initialization methods
-
- Closed
-