Class flag ACC_SUPER is mentioned in 2 places of JVMS 2ed:
Section 4.1 The ClassFile Structure:
"The setting of the ACC_SUPER flag indicates which of two alternative semantics for its invokespecial instruction the Java virtual machine is to express; the ACC_SUPER flag exists for backward compatibility for code compiled by Sun's older compilers for the Java programming language. All new implementations of the Java virtual machine should implement the semantics for invokespecial documented in this specification. All new compilers to the instruction set of the Java virtual machine should set the ACC_SUPER flag. Sun's older compilers generated ClassFile flags with ACC_SUPER unset. Sun's older Java virtual machine implementations ignore the flag if it is set."
Section 6 The Java Virtual Machine Instruction Set
Description of invokespecial:
"Next, the resolved method is selected for invocation unless all of the following conditions are true: invokespecial001
* The ACC_SUPER flag (see Table 4.1, "Class access and property modifiers") is set for the current class.
* The class of the resolved method is a superclass of the current class.
* The resolved method is not an instance initialization method (��3.9).
There are following confusions:
1. Phrase "ACC_SUPER flag indicates which of two alternative semantics for its invokespecial instruction the Java virtual machine is to express" looks like requirement to be able to implement any of two possible semantics and make choice depending on this flag.
By other hand there is another phrase: "All new implementations of the Java virtual machine should implement the semantics for invokespecial documented in this specification."
There are two options of interpretation of this phrase:
* this specification provides some semantic of invokespecial instruction, such new semantic should be implemented and value of ACC_SUPER flag should be ignored. Howerver, such interpretation contadicts with above mentioned phrase "ACC_SUPER flag indicates which of two alternative semantic..."
* this specification provides provides semantic for both cases - for ACC_SUPER set to 1 as well as for ACC_SUPER set to 0. Contents of invokespecial part of section 6 implies that such interpretation is correct however there are a couple of issues here:
** such contents is not visible from section 4.1 making interpretation harder
** phrase "All new implementations of the Java virtual machine should implement the semantics for invokespecial documented in this specification." look redundant in such case because such phrase is applicable to any semantics of any instruction documented in this specification. Why should we claim such requirement for one specific piece of spec ?
Such redundant claim may imply idea that first option of interpretation more relevant (in other words "let's ignore value of ACC_SUPER and implement what is described here").
I think it would be nice provide some general description of differences between old and new semantics in section 4.1. Another option is to add special section describing such differences with sevral examples at the end of chapter 4 with hyperlink to it located in section 4.1.
2. What does mean new/old compilers and VMs ? (precise versions of specification and Sun's JDK shoul be specified)
3. Construction of description in invokespecial part of Section 6 is not clear because condition involing ACC_SUPER flag is mixed with another conditions. It would be better to write something like this:
"Semantic of invokespecial depends on value of flag ACC_SUPER. If it is set then new semantics is applied. It means that special method lookup procedure is used if following conditions are both true:
# The class of the resolved method is a superclass of the current class.
# The resolved method is not an instance initialization method (��3.9).
then description of lookup procedure and phrase
"if ACC_SUPER is clear then lookup procedure is not applied"
It would be better because it will emphasize meaning of ACC_SUPER flag.