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.
1. Create new simple java class ClassG package simpleproject123; import java.util.*; public class ClassG { HashMap<Integer, String> nodes = new HashMap<Integer, String>(); public void printById(String s1, Integer p1, String s2){ } } 2. Put caret into the body of "printById" 3. Type "Object o = nodes.ge", using Ctrl+Space invoke code completion and double-click on "get(Object o) String" value >> ERR 1: Code completion have been performed "Object o = nodes.get(s2)" what is wrong. Key value is defined as Integer, so it should be "Object o = nodes.get(p1)". >> ERR 2: Rewrit "public void printById(String s1, Integer p1, String s2)" to "public void printById(int p1)" and invoke code completion again on "nodes.ge" (WITHOUT associating to "Object o = ") - a few times I got result "nodes.get(this)" before it have started to recognise correctly: "nodes.get(p1)", perhaps you'll be able to reproduce [ERR 2] Product Version: NetBeans IDE 7.4 RC2 (Build 201309252201) Java: 1.7.0_40; Java HotSpot(TM) Client VM 24.0-b56 Runtime: Java(TM) SE Runtime Environment 1.7.0_40-b43 System: Windows 7 version 6.1 running on x86; Cp1252; en_US (nb)
Created attachment 140547 [details] step_01
Created attachment 140548 [details] step_02
The ERR1 is invalid, method get() is declared as "public V get(Object key)" I cannot reproduce ERR2, only if I delete all parameters, the code completion use 'this' so maybe it is problem of "fast typing/slow source code scanning"
Unfortunately, I cannot reproduce the ERR2 either. Could you please try to reproduce the problem while profiling the IDE (using 'Profile the IDE' action)? Thanks.
I cannot reproduce ERR2, it seems it occurs very rarely. I still think ERR1 is not invalid because whenever "Object o = nodes.ge" is autocompleted the hint occurs saying "Given object cannot contain instance of String (expected Integer)". Product Version: NetBeans IDE 7.4 RC2 (Build 201309302222) Java: 1.7.0_40; Java HotSpot(TM) Client VM 24.0-b56 Runtime: Java(TM) SE Runtime Environment 1.7.0_40-b43 System: Windows 7 version 6.1 running on x86; Cp1252; en_US (nb)