No error when using generic class without defining a type
Why compiler do not produce any error? Where in JLS I can read about this
situation?
class Main {
public static void main(String[] args) {
A a = new A();
List<Integer> list = a.getStrings();
}
static class A<X> {
public List<String> getStrings() {
return new ArrayList<String>();
}
}
}
No comments:
Post a Comment