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.
Steps to reproduce: 1) Create Java Project 2) In the project create a new Java class file 3) Then create a dummy method 4) Inside the dummy method type the following lines - Collections.sort(new 5) The code completion will popup in the editor with multiple results of each data structure for example if you type Collections.sort(new Arr you will find two results with ArrayList<T> Dev Build 200809081401 JDK 6 Update 10
Created attachment 69430 [details] Screen Shot
Not sure why this was a P2 - could you please elaborate on that?
jlahoda>>> I cant use the Collections.sort() in any of my projects thats why
Sorry, but I still do not understand - how are you blocked by duplicated entries in the code completion?
follow the given steps to reproduce the bug then you will figure out
*** Issue 146659 has been marked as a duplicate of this issue. ***
I followed the steps. I see duplicated entries and get an exception (issue #146659). I can use the CC to fill in ArrayList using non-smart code completion. I can write new ArrayList() manually, so I can use Collections.sort(new ArrayList()); (which, BTW, seems as a completely useless code to me).
>>>I followed the steps. I see duplicated entries and get an exception (issue #146659). If you see duplicated entries and get an exception when using code completion then please fix that issues. >>>I can use the CC to fill in ArrayList using non-smart code completion. I can write new ArrayList() manually, so I >>>can use Collections.sort(new ArrayList()); (which, BTW, seems as a completely useless code to me). What is the purpose of having code completion then ,if the developers use non-smart code completion ??? Then we don't need a IDE ... also don't worry about the code.
I would like to clarify a few things (please do not take this personally): -no-one is arguing that the duplicated entries and exception are not a bug - it is a bug and dbalek is the correct person to fix this. -I still think this does not qualify as a P2 - the code completion does not work properly in some cases (most likely not so much common). If this would be a P2, what priority would be hypothetical bug that the CC does not work at all? What priority would be that the IDE leaks a lot? Making all issues P2 and P1 is not very helpful. -I think that when filling a P2 or P1 bug, the reporter should ensure that the reasons for the priority are clear - either the priority is automatically justified (e.g. deadlock), or the bug should contain a clear explanation -the justification "I cant use the Collections.sort() in any of my projects thats why" is not true - you can use the Collections.sort, only the CC will not be very helpful. If the justification would be "the CC does not work properly in this case, and I think it is quite common case" or "happens to me very often, very annoying", I still could disagree (and we might discuss about it, if necessary), but the justifications as such would be true.
>>>jlahoda >>>the bug should contain a clear explanation >>>-the justification "I cant use the Collections.sort() in any of my projects thats why" is not true - you can use the >>>Collections.sort, only the CC will not be very helpful The main problem is usability. I changed it to P2 due to the following description i found in the following link [1]Bug Priority Guidelines. My comments regarding "I cant use the Collections.sort() in any of my projects thats why" was a quick explanation about my case to the developer and i didn't use it intentionally as a justification to my problem. I made my judgment mainly by referencing the following links usability section which clearly states "Critical usability problem Improperly or inconsistently named or ordered item in main menu, project contextual menu, editor contextual menu, new file wizard, new project wizard and main toolbar." [1]http://wiki.netbeans.org/BugPriorityGuidelines#section-BugPriorityGuidelines-P2
Build: NetBeans IDE Dev (Build 200809120201) VM: Java HotSpot(TM) Client VM, 10.0-b23, Java(TM) SE Runtime Environment, 1.6.0_07-b06 OS: Windows XP, 5.1, x86 User Comments: final Set<OrderedSet<T>> result = Hash| Stacktrace: java.lang.IllegalArgumentException: <none> at com.sun.tools.javac.model.JavacTypes.getWildcardType(JavacTypes.java:209) at org.netbeans.api.java.source.TypeMirrorHandle.resolve(TypeMirrorHandle.java:307) at org.netbeans.api.java.source.TypeMirrorHandle.resolve(TypeMirrorHandle.java:263) at org.netbeans.api.java.source.TypeMirrorHandle.resolve(TypeMirrorHandle.java:294) at org.netbeans.api.java.source.TypeMirrorHandle.resolve(TypeMirrorHandle.java:263) at org.netbeans.api.java.source.TypeMirrorHandle.resolve(TypeMirrorHandle.java:263)
Created attachment 69862 [details] stacktrace
Build: NetBeans IDE Dev (Build 200809120201) VM: Java HotSpot(TM) Client VM, 10.0-b23, Java(TM) SE Runtime Environment, 1.6.0_07-b06 OS: Windows XP, 5.1, x86 User Comments: code completion with generics specifically <T extends Comparable<? super T>> Stacktrace: java.lang.IllegalArgumentException: <none> at com.sun.tools.javac.model.JavacTypes.getWildcardType(JavacTypes.java:209) at org.netbeans.api.java.source.TypeMirrorHandle.resolve(TypeMirrorHandle.java:307) at org.netbeans.api.java.source.TypeMirrorHandle.resolve(TypeMirrorHandle.java:263) at org.netbeans.api.java.source.TypeMirrorHandle.resolve(TypeMirrorHandle.java:294) at org.netbeans.api.java.source.TypeMirrorHandle.resolve(TypeMirrorHandle.java:263) at org.netbeans.api.java.source.TypeMirrorHandle.resolve(TypeMirrorHandle.java:218)
Created attachment 69871 [details] stacktrace
It is not just Collection.sort() which triggers this problem - I have it blinking at me for nearly everything to do with generics when editing code inside a static method with a generic parameter. Given the fact that an error dialog pops up every single time I try to type "." etc., because CC pops up by default and triggers this bug, and also because in development builds the logger pops up whenever there is an exception, IMHO this is a serious usability issue. (And by workaround - I hope you don't mean not using Code Completion altogether. In which case - even P1 bugs have workarounds...)
If the problem is happening a lot, I have no problems with P2. But, I have never seen the problem myself and the original report talked only about Collections.sort(new |), which does not seem to justify P2.
>>>alexlams >>>IMHO this is a serious usability issue alex could you please explain this in a simple manner to the developers (jlahoda,dbalek) because i explained them about this matter and got fed up with them and your doing me a great favour by helping me out to explain this matter to them
I've just found out that it is not static methods only - but any methods with a return type which has any generic parameters. Whenever I tried to type my "return" statement that creates a class with generic parameter, the error dialog pops up.
Fixed. changeset 8aabf401d3cb in main/nb-javac details: http://hg.netbeans.org/main/nb-javac?cmd=changeset;node=8aabf401d3cb changeset 2b23053cc9ab in main details: http://hg.netbeans.org/main?cmd=changeset;node=2b23053cc9ab
Integrated into 'main-golden', will be available in build *200809180201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main/rev/2b23053cc9ab User: Dusan Balek <dbalek@netbeans.org> Log: Issue #146670: Code completion on Collection.sort(<collection>,<comparator>) Produces Duplicate Results - fixed.
Verified on 200809181401