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. Get some class with constructor with at least one parameter 2. In explorer open the list of constructor of that class 3. prepare the string for using code completetion 4. save all and wait few sec to be sure parsing is ok. 5. check code completetion 6. change the parameter name or type 7. use arrow keys to get to place where you are checking code completetion 8. check code completetion 9. The code completetion should show old values. If you repeat the same, but you will wait few seconds before step 8. all will work ok. It looks like that if you use code completetion before the parser manages to reparse the source code the old values will be remembered also after the parser will reparse the source.
I think I found what is causing the problem. In NBJavaSyntaxSupport within refreshClassInfo method the check for jcValid property is causing that the classInfo is not refreshed. So, now it works in following way: 1. When the Code Completition is called for the first time, the classInfo is refreshed and jcValid is set to true. However in some cases the parser still did not finish the parsing and therefore old information is displayed (so far ok) 2. Now the problem is that when parser finished the parsing the jcValid property is not set back to false. So when CC is called again without any source modification it does not refresh the classInfo. Possible solutions: 1. Remove jcValid check - probably easiest but probably not good 2. Set up jcValid to false when the java parser is finished with parsing...
fixed in [maintrunk] it was neccessary to reparse source element during refreshClassInfo() operation ... /cvs/editor/src/org/netbeans/modules/editor/java/NbJavaSyntaxSupport.java,v <-- NbJavaSyntaxSupport.java new revision: 1.37; previous revision: 1.36
Honza, thank you for your help with the fixing.
This fix probably introduces huge performance regression: 1. Open a file. 2. Into some method try to write "Toolk". 3. Invoke Code completion. 4. Change text ("Toolk" to something similar ["Tool"]). 5. Repeat 3&4. Sometimes happens that Code completion block AWT for a while (10-15 seconds). I will attach thread dump from such a situation.
Created attachment 6203 [details] Thread dump while invoking code completion (IDE freezed).
fixed in [maintrunk] Now AWT thread is not blocking by waiting for parsing finish. /cvs/editor/src/org/netbeans/modules/editor/java/NbJavaSyntaxSupport.java,v <-- NbJavaSyntaxSupport.java new revision: 1.38; previous revision: 1.37
This problem also affects the retrieving the members of some private variable. private String s; void foo(){ s.| } Invoke the completion after "s.". It should show members of String. Then delete or comment s. (make source compilable) and save the document. Try to invoke the completion in the same place after "s." again. Completion is not shown even after several invocations. Document has to be modified to workaround this.
Sorry, the last comment belongs to the issue #33509
Resolved for 3.3.x or earlier, no new info since then -> closing.
Reopened due to performance reasons (issue #34732). The fix was rollbacked.
fixed in [maintrunk] /cvs/editor/src/org/netbeans/modules/editor/java/NbJavaSyntaxSupport.java,v <-- NbJavaSyntaxSupport.java new revision: 1.48; previous revision: 1.47 How to easy reproduce and test the fixed problem: 1.create class that contains only one variable int i; 2.save the source 3. create second variable int j; and immediately invoke completion by CTRL+SPACE variable j is missing in completion and if you reopen completion window it will not be display again. As a workaround the source needs to be modified and reparse again. The fix attached a listener to java parser, so the completion DB is updated immediately after java source hierarchy is updated. (After 2 seconds of idle time by default)
Verified in 200502031900.