clarification of 18.2.3

Rafkind, Jon jon.rafkind at hp.com
Mon Oct 28 18:06:33 PDT 2013


Section 18.2.3 Subtyping Constraints of jsr 335 says

A constraint formula of the form ⟨S <: T⟩ is reduced as follows:
  ...
  If T is a non-parameterized class or interface type, C, then the constraint reduces to true if S is a parameterization of C, or if C is a superclass or superinterface of T, and false otherwise.

1. What is the point of introducing a new metavariable C? It seems that C == T
2. I assume the point of this rule is to handle the case where a type has T does not have type parameters even though its class declaration has them:

List<a1> <: List

Where a1 is some inference variable. In this case, any parameterization of List is a subtype of List. Is that right?

3. The last clause seems vacuous. 'if C is a superclass/superinterface of T' but C == T, so assuming superclass/superinterface means a proper super then C can never be its own super type. Also this leaves S out. Is it a typo, and it should instead read as

'or if C is a superclass or superinterface of S ...'

Which would handle the case of

List<a1> <: Collection


More information about the lambda-dev mailing list