In Java, why does an untyped invocation of a constructor of parameterised type provoke a compiler warning? Why is it okay to do similar thing with a static method? For example:
class Test<T> {
Test() {}
static <T> Test<T> create() {
return new Test<T>();
}
@SuppressWarnings("unused")
public static void main(String[] args) {
Test<String> warning = new Test(); // compiler warning - why?
Test<String> okay = Test.create(); // no warning here - why?
Test<String> okay2 = Test.<String>create(); // why doesn't it need this?
}
}