This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
LinkedList<Integer> list = new <Integer>LinkedList(); The output window produces: GenericsThreeTest.java:11: cannot find symbol symbol : constructor <java.lang.Integer>LinkedList() location: class java.util.LinkedList LinkedList<Integer> list = new <Integer>LinkedList(); 1 error
Reassigning to editor for evaluation.
reproducible all wrong invocation methods with generics are not highlighted e.g. System.out.<Integer>println(""); Product Version: NetBeans IDE Dev (Build 20080905031732) Java: 1.6.0_10-rc; Java HotSpot(TM) Client VM 11.0-b13 System: Linux version 2.6.22-15-generic running on i386; UTF-8; en_US (nb)
In fact, specifying the explicit type parameters to an invocation of a method that is not a generic method is not a compile-time error - see JLS 15.12.2.1. JDK1.7b26 javac compiles such code without complaints. So we should decide whether we should mark such invocations with errors for certain source levels, or with warning, or do nothing, or ?.
Overtake.
*** Issue 167336 has been marked as a duplicate of this issue. ***
IMO a warning is in order for static methods and constructors. For those methods the rationale given in JLS 15.12.2.1 does no apply, because they can't be overriding a method from a supertype (just hide one, for static methods).
Seems like a bug in 1.6 javac compiler that has been recently fixed in 1.7 javac (which is used as a base for the internal NB-javac). If you try to set the project's Java platform to JDK 1.7, no compilation errors are reported. Closing as WONTFIX on NB side.
FYI: I filed issue 170050 for implementing a warning on static methods and constructors, as suggested above,