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 43628 - Java Error Annotation are given, but class can be compiled.
Summary: Java Error Annotation are given, but class can be compiled.
Status: RESOLVED WORKSFORME
Alias: None
Product: java
Classification: Unclassified
Component: Unsupported (show other bugs)
Version: 4.x
Hardware: PC Other
: P3 blocker (vote)
Assignee: issues@java
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-05-20 15:50 UTC by vbrabant
Modified: 2007-09-26 09:14 UTC (History)
0 users

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 15:50:59 UTC
NB200405182245 JDK 1.4.2
Steps to reproduce:
I create a MyCollectionTest junit class in
TestPackage.

It contains the following code: 
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());
    }

Lines 
private MyCollection collection;
collection = new MyCollection(); collection.isEmpty()
collection.size()
collection.containsString()
collection.addString()
have a java annotation Cannot resolve symbol
MyCollection.
Now, I will create the class MyCollection in the
Source Packages, in the same package as the
MyCollectionTest
After creation of MyCollection, I switch back to
MyCollectionTest, and only those two following
lines are now in error: 
private MyCollection collection;
collection = new MyCollection(); 
Other ones are not any more marked as in error.

Now, I do the following:
delete the line
private MyCollection collection;
retype private MyCol|
press Ctrl-Space
NB propose MyCollection
I introduced collection;
And I finally have the same line
private MyCollection collection;
but always marked as in error.
I select MyCollection, press Alt-Shift-I to do the
import. NB confirm that MyCollection is well in
the same package than MyCollectionTest by adding
no import sentence.

I do Clean and Build.
MyCollection is now marked as compiled.
and no more Java Error Annotation appears in the
class MyCollectionTest.
Comment 1 psuk 2004-05-25 10:06:18 UTC
Assigning to java module.
2 major points from the report:
a) both classes are from the same package, but they are
   stored in different locations (TestPackage, Source Packages)
b) Clean/Build helped
Comment 2 Martin Matula 2004-07-26 15:42:43 UTC

*** This issue has been marked as a duplicate of 41630 ***
Comment 3 Martin Matula 2004-07-26 15:45:58 UTC
Reopening - was marked as a duplicate by mistake.
Comment 4 Martin Matula 2004-07-26 15:53:41 UTC
This works for me in current builds.
Please remember that:
- if you add something to a file, you need to save the file before it
is visible to other files (otherwise you will get error annotation
that the added construct is missing)
- you need to edit the file in order to get the error annotations
refreshed