Bug 100588 - False package error when adding source folder.
Summary: False package error when adding source folder.
Status: RESOLVED DUPLICATE of bug 65267
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-Text-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-06-17 10:52 EDT by Brian Miller CLA
Modified: 2005-06-20 10:33 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Brian Miller CLA 2005-06-17 10:52:54 EDT
Steps:

1) Open an existing Java project in Eclipse and enable automatic building.

2) Using a native shell, create a new directory 'foo' in the project's top 
directory.  Create 'bug' as a subdirectory of 'foo'.

3) Using a native editor, save text "package bug;class Bug{}" as 
foo/bug/Bug.java.

4) Open foo/bug/Bug.java in Eclipse.

5) In PackageExplorer add 'foo' as a Source Folder.  See that the package 
statement in foo/bug/Bug.java is falsely flagged as an error saying "The 
declared package does not match the expected package".  Adding whitespace and 
saving doesn't eliminate the false error.  Closing Bug.java and reopening it 
is needed to remove the false error.
Comment 1 Dirk Baeumer CLA 2005-06-20 04:16:10 EDT
Brian,

how did you open the editor in step 4. Did you do a refresh in Eclipse before to
see Bug.java ?
Comment 2 Brian Miller CLA 2005-06-20 09:56:33 EDT
I never did a project refresh.  I saw the 'foo' directory spontaneously appear 
in the Package Explorer tree.  So for step 4, I expanded the 'foo' tree node, 
then expanded the 'bug' subnode, and then doubleclicked on the Bug.java 
subnode.  That opens Bug.java in the source text editor.
Comment 3 Dirk Baeumer CLA 2005-06-20 10:29:10 EDT
Then I guess you have "Refresh automatically" under
Preferences->General->Workspace checked.

There is no need to create this externally. Here are steps to reproduce this
internally.

- create project P
- create package foo
- create package foo.bug
- create CU Bug in foo.bug, but chage package declaration statement to bug

- save file.

observe: you correctly get a compile error

- select package foo
- execute Build Path->Use as source folder
- answer all questions with Yes.

observe: a compile is triggered and the problem is removed from the problem
view and the package explorer. However, the problem in the editor stays.
Comment 4 Dani Megert CLA 2005-06-20 10:33:01 EDT

*** This bug has been marked as a duplicate of 65267 ***