Bug 24172 - Strange behavior with wrong package declaration
Summary: Strange behavior with wrong package declaration
Status: RESOLVED WORKSFORME
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.0   Edit
Hardware: PC Windows 2000
: P3 critical (vote)
Target Milestone: 2.1 M2   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-09-27 05:12 EDT by Dani Megert CLA
Modified: 2003-03-23 12:25 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dani Megert CLA 2002-09-27 05:12:36 EDT
Build 20020921 M1

Create a workspace and fill it with the following source (it's also attached as
JAR):
<workspace>/a/b/c/A.java:
package a.b.c;
public class A {
  public void doIt() {
  }
}
<workspace>/Test.java
import a.b.c.A;
public class Test {
  void doIt() {
    new A().doIt();
  }
}

Rebuild All
Change the package declaration in A.java to "package a.b.c.d;"
Save (NOTE: Ensure that refactoring does not fix/change the files.)
Rebuild All

Only 1 error marker (on A.java)
Now look at Test.java:
==> there is no error marker (--> is the file OK? No) but quick fix and quiggly
lines are drawn in the editor.

When doing the same test scenario in Eclipse 1.0 I get 1 error marker on A.java
and also 2 error markers on Test.java (which is OK).
Comment 1 Dani Megert CLA 2002-09-27 05:31:38 EDT
sorry wrong component - moving to JDT Core
Comment 2 Philipe Mulet CLA 2002-09-27 06:02:00 EDT
I presume you meant <project> instead of <workspace>.
Comment 3 Dani Megert CLA 2002-09-27 06:06:01 EDT
Of course - stupid me
Comment 4 Kent Johnson CLA 2002-09-30 14:34:44 EDT
The difference is because of the Java builder change from 1.0 to 2.0.

The 2.0 Java builder produces a .class file a/b/c/A.class even after the change 
to the package declaration.

This is not a bug... just a consequence of changing the builder & how it 
handles this error.
Comment 5 Dani Megert CLA 2002-10-01 05:50:40 EDT
OK - so you say that the class with the wrong package declaration gets generated
as if the package declaration was correct i.e. A.class is identical to the class
that got generated if the package declaration would be correct?

Does the Java spec not define how errors have to be reported?

The problem with the 2.0 behavior is that if I take the source and then build
with JDK it will fail, right?