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.
Summary: | IDE Improperly marking code with generics as bad | ||
---|---|---|---|
Product: | java | Reporter: | james.kosin |
Component: | Compiler | Assignee: | Dusan Balek <dbalek> |
Status: | RESOLVED INVALID | ||
Severity: | normal | ||
Priority: | P3 | ||
Version: | 6.x | ||
Hardware: | All | ||
OS: | All | ||
Issue Type: | DEFECT | Exception Reporter: |
Description
james.kosin
2010-06-21 00:37:00 UTC
Any ideas on this issue? A more basic example exhibiting the problem. This compiles in 1.6.0_20 but is flagged as an editor error in NB6.9 public static void main( String[] args ) { a(new ArrayList<String>()); a(new ArrayList<Integer>()); } public static String a(List<String> l) {return null;} public static Integer a(List<Integer> l) {return null;} This actually produces 2 errors... (In reply to comment #2) > A more basic example exhibiting the problem. This compiles in 1.6.0_20 but is > flagged as an editor error in NB6.9 > public static void main( String[] args ) > { > a(new ArrayList<String>()); > a(new ArrayList<Integer>()); Error here about not finding a() for an Integer type. > } > public static String a(List<String> l) {return null;} > public static Integer a(List<Integer> l) {return null;} Error here about the name conflict. No idea :-(, but passing to the ones who know... (In reply to comment #4) > No idea :-(, but passing to the ones who know... It isn't java that is complaining but the IDE is providing what seems to be improper hints and errors. I'd wish they where warnings; but, don't know why NB6.9 is the only IDE complaining on this. I am afraid that the error is correct - (loosely speaking) the methods must have different erased parameters, which is not true in the test cases: public static String a(List<String> l) {return null;} public static Integer a(List<Integer> l) {return null;} => public static String a(List l) {return null;} public static Integer a(List l) {return null;} (return types do not count in this case). It is true that javac from JDK5 and 6 accepted such programs, but it was a bug. Current javac from JDK7 does not AFAIK. NetBeans uses its own copy of javac internally to parse the sources, and NB6.8 and earlier used older versions of javac that had the bug, and NB6.9 uses a newer javac which does not have this bug. Sorry, but I do not think there is anything that should be done. For the record, the javac bug that relates to this is: http://bugs.sun.com/view_bug.do?bug_id=6182950 and the specification is JLS 8.4.8.3. |