§9.2.2 Type conformance

Two value dependent types (anchored types) are considered conform only if the anchors of both types refer to the same object(s). The compiler must be able to statically analyze this anchor identity.

(a) Substitutions for type anchors

Only two substitutions are considered for determining anchor identity:

  1. If a method signature uses this as the anchor of any of its types, type checking an application of this method performs the following substitutions:
    A simple this expression is substituted by the actual call target of the method application.
    A qualified Outer.this expression is substituted by the corresponding enclosing instance of the call target.
  2. Assignments from a final identifier to another final identifier are transitively followed, i.e., if t1, t2 are final, after an assignment t1=t2 the types C<@t1> and C<@t2> are considered identical. Otherwise C<@t1> and C<@t2> are incommensurable.
    Attaching an actual parameter to a formal parameter in a method call is also considered as an assignment with respect to this rule.

(b) Conformance of raw types

After anchors have been proven identical, the raw types are checked for compatibility using the standard Java rules.