Clarifications and Amendments to the Inner Classes Specification


The following  applies to the section entitled How does the Java Language Specification change for inner classes?

The discussion of the production
 

PrimaryNoNewArray: ...
        ClassName . this

should state that:

The value of  an expression  of this form is a reference to the current instance of the enclosing class named ClassName, which is required to exist.
 

In addition, the section should also state that:

The JLS syntax productions for FieldAccess and MethodInvocation are extended as follows:
 

FieldAccess: ...
        ClassName . super . Identifier
 

MethodInvocation: ...
        ClassName . super . Identifier ( ArgumentListopt )

In each case, the value of ClassName.super is the current instance of the
enclosing class named ClassName, which is required to exist.
 

Implementation note:  If an access method is necessary, it must
be placed in the class named by ClassName, not in its superclass.
The superclass may not necessarily be defined in the same
compilation unit, and may have been compiled previously.

The scope rules for nested classes have been subject to varying interpretations. The following statements clarify the intended scope rules:
 


The third paragraph of the section Members that can be marked static is amended to make an exception and allow inner classes to declare static final fields that are compile time constants as members.

The binding definitions of the  InnerClasses and Synthetic  attributes are given by the Java Virtual Machine Specification, not by the inner classes specification.


The nested classes white paper states that

Any inherited member m of a subclass C is in scope within the body of C, including any inner classes within C. If C itself is an inner class, there may be definitions of the same kind (variable, method, or type) for m in enclosing scopes. (The scopes may be blocks, classes, or packages.) In all such cases, the inherited member m hides the other definitions of m. Additionally, unless the hidden definition is a package member, the simple name m is illegal; the programmer must write C.this.m.
The restriction listed in the last sentence of the paragraph above (the bold text) has been lifted.