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.
[ BUILD # : 200402251620 ] [ JDK VERSION : J2SE 1.4.2_02 ] Two NetCAT project participants reported problems of code-completion in editor. Unfortunately these were not reproducible. [1] Firstly there was a loop of below attached exceptions when repeating CTRL+Space keystroke. The workaround was to close the completion window and reopen it again. More details from Gabriele Carcassi: I was using auto-complete on a class that I wrote, which only had two static methods. When I wrote: ClassName. The auto-complete didn't appear, and I started getting the exceptions. They would always come in a group of three. Every Ctrl+space, three exceptions. Switching file in the editor didn't work, I had to close them all. I didn't need to restart though ... I wasn't able to reproduce it afterwards. [2] Secondly there were incorrect suggestions displayed. The details from Lluis Turro follow: I remember I was modifying source and editor could not bear so much errors --more than the allowed parameters in a method call, a class not still imported and the like-- and code completion started showing empty popups and mistaking the class the caret was on. Then came the crash. I changed the number of parameters of a method in a different class, so the line was underlined. I had java.sql.Date class imported and code completion was mistaking that class. It took java.util.Date. I have seen this more than once when trying to call code completion if there are lines underlined above. The fact is that don't work when there are lines underlined above. When this happen, the popup showing the methods is empty. It had the minimum height to recognize it. I noticed that sometimes, after an exception has raised, code completion may found static members, but not static methods --ResourceBundle.class but not ResourceBundle.getBundle()--. I just reproduced and saved the screen. See the attachments.
Adding original reporters from NetCAT program.
Created attachment 13797 [details] Exception thrown when CTRL+Space was pressed.
Created attachment 13798 [details] Screenshot of good code completion.
Created attachment 13799 [details] Screenshot of bad code completion.
The first problem is IMHO a JDK issue as the exception occurs in the swing BoxView code and we invoke it in AWT so there should be nothing wrong on our side. I've searched Bug Parade and found some issues regarding BoxView but none of them was exactly this problem. Martin R., please evaluate the second problem. Thanks.
RC1's code completion popup raised an exception, as it did last build, related to BoxView: java.lang.ArrayIndexOutOfBoundsException: 0 at javax.swing.text.BoxView.getOffset(BoxView.java:1079) at javax.swing.text.BoxView.childAllocation(BoxView.java:669) This time, though, doesn't force to restart the IDE and it shows only once. Details: I was replacing request to pageContext.getRequest() in code pasted into a class from a JSP.
After typing some more code, next time code completion tried to show started raising exceptions and I was forced to stop the IDE. In order to save my work I had to press the OK button and quickly click on save with the mouse --good I had some attempts ;)--.
As for second problem: I cannot reproduce it. But it seems that finder couldn't find appropriate methods for ResourceBundle. Could you please attach your ide.log file? Also make sure the files <IDE_install_dir>/system/ParserDB/jdk14.jcs and jdk14.jcb are available. Their size should be 239 439 and 3 384 954 bytes. If you will remember any code completions DB operations (i.e. mounting/unmounting filesystem, managing databases via Toos/Code Completion Database Manager) you did before the problem occured, this will help a lot. Thanks, Mato
Hugg... I just reinstalled the IDE due another problem related to Runtime -> Database -> Drivers. Because I'm reinstalling NB so many times I'm not keeping userdir copies. Next time... ;)
Changing back [36cat] prefix because of NetCAT dashboard. I hope you don't mind it Petre.
Changing subcomponent to code completion
*** Issue 41388 has been marked as a duplicate of this issue. ***
I finally had some time to look at my problems with the code completion more carefully. I have started from scratch: new netbeans, new user directory and new source tree. I hoped it was just a problem with some weird state: it wasn't. What I did: 1) Installed NB RC2 2) Took the codebase of my project from CVS Nothing else. I see that: 1) Code completion, auto import and goto sources do not work on the code that I have written. 2) They work perfectly on libraries, but not on my source 3) Code completion and goto sources work on the class I am editing. That is, if I do this.[Ctrl+space] I do see everything I am supposed to see. If I goto source of a method of that class, it goes. To make an example, say I am writing: public class MyClass { public List a; public MyOtherClass b; public void myMethod() { ... } } If inside myMethod() I write: a.[Ctrl+space] // it works this.[Ctrl+space] // it works b.[Ctrl+space] // doesn't work IMHO, if it confirmed by other users, this is a P1: it's a regression that affects several functionalities, making them half as useful...
Gabriele, could you provide jdk version please ? I tried to reproduce your scenario, but without success. Can you attach the sources, where the problem occurs ? Does the MyOtherClass have the "private" modifier?
I am using JDK 1.4.2_04. I have both public and package-private classes, no private. I will try to package some sort of sources that can show the problem. Another idea: I would assume that the code completion database resides in some file. If it would help you, I could send you that (assuming someone told me which file to send... ;-) ): it might not tell you why it got messed up, but it might give ideas...
I guess the problem is that the class that you are trying to open is package-private but the code-completion databases only store the classes/methods with public-protected modifiers. Could you please try to goto the root node of the filesystem on which the problematic class resides and right-click on it and choose "Update code completions" in the tools submenu. You will likely see "Protected and Public" under storage levels. Please change it to "All except private" or "All" and hit OK to regenerate the DBs. Does it help to avoid the problem?
*** Issue 41909 has been marked as a duplicate of this issue. ***
Hhhhmmm... I haven't been looking to this bug for some time, and it's missing some comments I thought I had reported. On the cat36 list we basically figured out a workaround of one aspect (namely, the usecase I presented). Here is part of the discussion: --- I am desperately trying to find a repro case, I still haven't but I am now sure it has to do with CVS: the _same_ directory mounted as CVS or as local filesystem behaves differently: in the first case it doesn't work, and in the second it does. --- I have a couple of projects that uses the same code base. All sources are taken from a server CVS. The completion code does not work for any classes from my code base packages. I have a workaround for this issue. Usually I update Code Completion Data Base Manager file systems with the path to my project dir. After that the code completion is working OK. ---
*** Issue 42579 has been marked as a duplicate of this issue. ***
As for first problem, it is JDK issue: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5042872
I have tried to reproduce in the nowadays MDR-based builds and it appears to work fine. Please reopen the issue if you still experience the problem.
Verified in FCS build #200505031930 of NetBeans 4.1.