Java Reference
In-Depth Information
• If the expression is referenced by a simple name, then if f is a member of the
current class or interface, C , then let T be C . Otherwise, let T be the innermost
lexically enclosing class of which f is a member. In either case, T is the qualify-
ing type of the reference.
The reference to f must be compiled into a symbolic reference to the erasure (§ 4.6 )
of the qualifying type of the reference, plus the simple name of the field, f . The ref-
erence must also include a symbolic reference to the erasure of the declared type of
the field so that the verifier can check that the type is as expected.
5. Given a method invocation expression in a class or interface C referencing a meth-
od named m declared (or implicitly declared (§ 9.2 )) in a (possibly distinct) class or
interface D , we define the qualifying type of the method invocation as follows:
• If D is Object then the qualifying type of the expression is Object .
• Otherwise:
♦ If the expression is of the form Primary . m then:
If the compile-time type of Primary is an intersection type (§ 4.9 ) V 1 & ...
& V n , then the qualifying type of the method invocation is V 1 .
Otherwise, the compile-time type of Primary is the qualifying type of the
method invocation.
♦ If the expression is of the form super. m then the superclass of C is the qualify-
ing type of the method invocation.
♦ If the expression is of the form X .super. m then the superclass of X is the quali-
fying type of the method invocation.
♦ If the reference is of the form X . m , where X denotes a class or interface, then
the class or interface denoted by X is the qualifying type of the method invoca-
tion.
♦ If the method is referenced by a simple name, then if m is a member of the
current class or interface, C , then let T be C . Otherwise, let T be the innermost
lexically enclosing class of which m is a member. In either case, T is the quali-
fying type of the method invocation.
A reference to a method must be resolved at compile time to a symbolic reference
to the erasure (§ 4.6 ) of the qualifying type of the invocation, plus the erasure of the
signature (§ 8.4.2 ) of the method. The signature of a method must include all of the
following as determined by § 15.12.3 :
• The simple name of the method
Search WWH ::




Custom Search