0

Consider the following clause from JLS : 18.2.2

  • the following clause states that:

Otherwise, if T is a parameterized type of the form G<T1, ..., Tn>, and there exists no type of the form G<...> that is a supertype of S, but the raw type G is a supertype of S, then the constraint reduces to true.

  • When we try to relate this to the following example:
public class Scratch {
  public static void main(String[] args) {
    List<Integer> ls = new ArrayList();
  }
}
  • this gives unchecked warning - as I am trying to target Raw type ArrayList -> List<String>.

Am I missing something here - not sure if this constraint formula should be the otherway round - to return true always?

theutonium.18
  • 483
  • 2
  • 7

0 Answers0