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.

Bug 40735 - [36cat][completion] Problems of auto-completion feature
Summary: [36cat][completion] Problems of auto-completion feature
Status: VERIFIED FIXED
Alias: None
Product: editor
Classification: Unclassified
Component: Completion & Templates (show other bugs)
Version: 3.x
Hardware: PC Windows ME/2000
: P3 blocker with 3 votes (vote)
Assignee: issues@editor
URL:
Keywords:
: 41388 41909 42579 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-03-03 17:34 UTC by Jiri Kovalsky
Modified: 2007-11-05 13:38 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Exception thrown when CTRL+Space was pressed. (2.28 KB, text/plain)
2004-03-03 17:37 UTC, Jiri Kovalsky
Details
Screenshot of good code completion. (14.46 KB, image/png)
2004-03-03 17:38 UTC, Jiri Kovalsky
Details
Screenshot of bad code completion. (14.01 KB, image/png)
2004-03-03 17:38 UTC, Jiri Kovalsky
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jiri Kovalsky 2004-03-03 17:34:29 UTC
[ 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.
Comment 1 Jiri Kovalsky 2004-03-03 17:36:32 UTC
Adding original reporters from NetCAT program.
Comment 2 Jiri Kovalsky 2004-03-03 17:37:26 UTC
Created attachment 13797 [details]
Exception thrown when CTRL+Space was pressed.
Comment 3 Jiri Kovalsky 2004-03-03 17:38:05 UTC
Created attachment 13798 [details]
Screenshot of good code completion.
Comment 4 Jiri Kovalsky 2004-03-03 17:38:27 UTC
Created attachment 13799 [details]
Screenshot of bad code completion.
Comment 5 Miloslav Metelka 2004-03-04 13:02:48 UTC
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.
Comment 6 llturro 2004-03-18 16:29:17 UTC
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.
Comment 7 llturro 2004-03-18 16:30:12 UTC
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 ;)--.
Comment 8 Martin Roskanin 2004-03-19 16:21:22 UTC
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
Comment 9 llturro 2004-03-19 16:35:05 UTC
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... ;)
Comment 10 Jiri Kovalsky 2004-03-22 16:28:30 UTC
Changing back [36cat] prefix because of NetCAT dashboard. I hope you
don't mind it Petre.
Comment 11 psuk 2004-03-23 17:50:42 UTC
Changing subcomponent to code completion
Comment 12 Martin Roskanin 2004-03-26 09:12:46 UTC
*** Issue 41388 has been marked as a duplicate of this issue. ***
Comment 13 carcassi 2004-04-03 21:33:25 UTC
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...
Comment 14 pfelenda 2004-04-06 11:12:46 UTC
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?
Comment 15 carcassi 2004-04-06 13:51:18 UTC
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...
Comment 16 Miloslav Metelka 2004-04-07 13:29:38 UTC
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?
Comment 17 Martin Roskanin 2004-04-16 10:04:23 UTC
*** Issue 41909 has been marked as a duplicate of this issue. ***
Comment 18 Martin Roskanin 2004-04-16 10:05:21 UTC
*** Issue 41909 has been marked as a duplicate of this issue. ***
Comment 19 carcassi 2004-04-16 13:40:14 UTC
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.

---

Comment 20 Martin Roskanin 2004-05-04 13:48:36 UTC
*** Issue 42579 has been marked as a duplicate of this issue. ***
Comment 21 Martin Roskanin 2004-05-24 13:43:47 UTC
As for first problem, it is JDK issue:
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5042872
Comment 22 Miloslav Metelka 2004-07-19 12:34:47 UTC
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.
Comment 23 Jiri Kovalsky 2006-03-24 07:59:59 UTC
Verified in FCS build #200505031930 of NetBeans 4.1.