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 43631 - Code Completion not correctly working, even after Update the Code Completion Database Manager
Summary: Code Completion not correctly working, even after Update the Code Completion ...
Status: RESOLVED FIXED
Alias: None
Product: editor
Classification: Unclassified
Component: Completion & Templates (show other bugs)
Version: 4.x
Hardware: PC Windows 95/98
: P3 blocker (vote)
Assignee: Martin Roskanin
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-05-20 16:09 UTC by vbrabant
Modified: 2007-11-05 13:38 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description vbrabant 2004-05-20 16:09:17 UTC
NB200405182245 & JDK 1.4.2
This issue is certainly linked with issue 43628.
But issue 43628 is concerning Java Error Annotations.

Steps to reproduce:
Create in Test Packages a junit class
(MyCollectionTest)that use a class
(MyCollection)and methods(isEmpty(), size(), ...)
of a not yet existing class.
hereafter content of MyCollectionTest:

public class MyCollectionTest extends TestCase {
    private MyCollection collection;
    protected void setUp() {
        collection = new MyCollection();
    }
    public MyCollectionTest(java.lang.String
testName) {
        super(testName);
    }
    public static Test suite() {
        TestSuite suite = new
TestSuite(MyCollectionTest.class);
        return suite;
    }
    public void testAddString() {
        assertTrue(collection.isEmpty());
        assertEquals(0, collection.size());
       
assertTrue(!collection.containsString("string1"));
        collection.addString("string1");
        assertTrue(!collection.isEmpty());
    }
}

Create in Java Packages the class tested by the
junit class (MyCollection).
Switch to the Test class (MyCollectionTest)
Position cursor( symbolized by |) on the following
line:
        assertTrue(collection.is|Empty());
and press ctrl-space.
Nothing is proposed
I deplace the cursor to have
collection.|isEmpty());
and repress Ctrl-Space
No other methods are proposed.
I place the cursor (symbolized by |) on the line
assertEquals(0, collection.|size());
and press Ctrl-Space
NB propose all methods of MyCollection, including
isEmpty() method:
I move the line
        assertTrue(collection.is|Empty());
after the line 
assertEquals(0, collection.|size());
I place the cursor after collection.
and it's working.
I undo operation to have original situation
Code completion is working as normal.

Very very strange situation
Comment 1 Martin Roskanin 2004-05-20 16:40:17 UTC
I have reproduced something similar yet. 
I create a class One and the class Two. 
In class One I wrote "new Two().|"  => no CC result
I have to modified a class Two, save it and return back to One. After
that CC after "new Two().|" worked. The same if I add some members to
class Two. I.e: add a public void foo() method to Two class, save.
Return back to One, invoke "new Two().|", the method foo is not
present. I have to modify a Two class (i.e by adding a new method
foo2() ) and save the class. After that I see after "new Two().|" the
method foo, but foo2 is missing... It looks like some synchro problem.
This may be also connected with issue #43520

I have tested release36, it works correctly. We should fix it to promo-d
Comment 2 vbrabant 2004-05-20 17:51:31 UTC
Please note that it was not working for a line, but it was working for
another line OF THE SAME FILE, FOR THE SAME METHOD.

And that is really strange
Comment 3 David Konecny 2004-05-24 13:26:21 UTC
Re. Martin: I know about this problem and I believed that the same
problem was in NB36. But I might be wrong. The problem is that when
the file is saved the event comes to editor but at that time the
DataObject of the file was not yet reparsed and its SourceCookie is
out-of-date. But editor updates PDB with this old source hierarchy.
That's why second save solves this.
Comment 4 Martin Roskanin 2004-05-24 16:32:53 UTC
re. Vincent: yes, this is very strange. Wasn't the source modified
(accidentaly, by pressing a space or any other key?) during replacing
the cursor during testing completion on different places?
Unfortunately I cannot reproduce it. So, this will be probably
difficult to find out where the problem could be.

re. David: I cannot reproduce the problem that I described in my
previous comment in NetBeans 3.6. There could be some race condition
problem or some other listener misbehaviour, because except the
problem mentioned in issue #43520 there is similar problem with
deleted classes. If you delete class in explorer, it is still
available in completion => it wasn't deleted from CC DB. I believe,
these problems should be fixed by meta_stavbicka merge (I cannot
reproduce the problem there). That's why I will not fix these problems
in maintrunk for now. 
Comment 5 Miloslav Metelka 2004-07-19 13:20:37 UTC
This should now be resolved as there is no more the ParserDBs updating
going on so the problem described by David should no longer happen.
Please reopen if the problem would reappear.