Java Reference
In-Depth Information
• If F has the form G < ..., Y k-1 , U , Y k+1 , ... > , where U is type expression that involves
T j , then if A is of the form G < ..., X k-1 , V , X k+1 ,... > where V is a type expression, this
algorithm is applied recursively to the constraint V = U .
• If F has the form G < ..., Y k-1 , ? extends U , Y k+1 , ... > , where U involves T j , then if A is
one of:
G < ..., X k-1 , ? extends V , X k+1 , ... > . Then this algorithm is applied recursively to
the constraint V = U .
♦ Otherwise, no constraint is implied on T j .
• If F has the form G < ..., Y k-1 , ? super U , Y k+1 ,... > , where U involves T j , then if A is
one of:
G < ..., X k-1 , ? super V , X k+1 , ... > . Then this algorithm is applied recursively to the
constraint V = U .
♦ Otherwise, no constraint is implied on T j .
• Otherwise, no constraint is implied on T j .
4. Otherwise, if the constraint has the form A >> F :
• If F = T j , then the constraint T j <: A is implied.
We do not make use of such constraints in the main body of the inference al-
gorithm. However, they are used in § 15.12.2.8 .
• If F = U [] , where the type U involves T j , then if A is an array type V [] , or a type
variable with an upper bound that is an array type V [] , where V is a reference type,
this algorithm is applied recursively to the constraint V >> U . Otherwise, no con-
straint is implied on T j .
This follows from the covariant subtype relation among array types. The con-
straint A >> F in this case means that A >> U [] . A is therefore necessarily an
array type V [] , or a type variable whose upper bound is an array type V [] - oth-
erwise the relation A >> U [] could never hold true. It follows that V [] >> U [] .
Since array subtyping is covariant, it must be the case that V >> U .
• If F has the form G < ..., Y k-1 , U , Y k+1 , ... > , where U is a type expression that in-
volves T j , then:
♦ If A is an instance of a non-generic type, then no constraint is implied on T j .
In this case (once again restricting the analysis to the unary case), we have
the constraint A >> F = G < U > . A must be a supertype of the generic type G .
However, since A is not a parameterized type, it cannot depend upon the type
Search WWH ::




Custom Search