JDK-8252006 : 4.1: Clarify setting of ACC_SUPER flag
  • Type: Bug
  • Component: specification
  • Sub-Component: vm
  • Affected Version: 11
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • Submitted: 2020-08-18
  • Updated: 2020-08-19
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
tbd_majorUnresolved
Description
See https://mail.openjdk.java.net/pipermail/jls-jvms-spec-comments/2020-January/000061.html
Comments
The rule that "If ACC_INTERFACE is set, then ACC_SUPER must not be set" is longstanding and intentional. Java compilers emit class files that conform to it, and HotSpot enforces it. The problem is with the sentence "Compilers to the instruction set of the Java Virtual Machine should set the ACC_SUPER flag." This sentence is largely unnecessary, given the frame condition in the next sentence about assuming ACC_SUPER to be set, but we should not lightly remove advice to compilers. JVMS 4.1 should spell out that ACC_SUPER only needs to be set when ACC_INTERFACE is not set. Accordingly: ----- The ACC_SUPER flag indicates which of two alternative semantics is to be expressed by an invokespecial instruction in a `class` file that defines a class. The flag has no effect on an invokespecial instruction in a `class` file that defines an interface. Compilers to the instruction set of the Java Virtual Machine should set the ACC_SUPER flag in every `class` file that defines a class. In Java SE 8 and above, for the purposes of the invokespecial instruction, the Java Virtual Machine considers the ACC_SUPER flag to be set in every `class` file that defines a class, regardless of the actual value ... ----- The "Notes" for invokespecial in 6.5 should incorporate the following observations: ----- The process described above for selecting a method to be invoked is essentially a repetition of resolution, with a "ACC_SUPER adjustment" applied when a non-<init> method is referenced via an indirect superclass of the calling class. That is, the usual case involves a reference to either (i) an <init> method of a class, (ii) a non-<init> method of the direct superclass, or (iii) a method of a direct superinterface. In all three sub-cases, the "selected" method is the resolved method. For the special case of a reference to a non-<init> method of an indirect superclass, the "selected" method is the method that would have been the resolved method, had the reference pointed to the direct superclass instead of an indirect superclass. Note that it is impossible, per 4.9.2, to encounter an `invokespecial` instruction that refers to an indirect superinterface of a class or interface. It must be a direct superinterface. -----
19-08-2020