Community
Participate
Working Groups
This is similiar to the bug #6494 from 2001. The roll over text states "The declared package does not match..". This happens when the directory is x\y\z\w but the file in directory 'w' has the package x.y.z. The error indications propogate based off the one package error. Compile still works.
Not sure to understand what is the problem here, if you have following test case: x/y/z/w/Test.java: package x.y.z; public class Test {} Then using 3.1.2, there's a compile error which correctly states "The declared package does not match the expected package x.y.z" and quick-fix correctly proposes either to move the CU to x.y.z package or change package declaration to x.y.z.w. I surely miss something, can you provide more details on your offending test case?
From what directory are you compiling your file?
Created attachment 48144 [details] Simple test to show that it can compile Compiling using JDK 1.4.2_12 from the cmd line on WinXP Make directory c:\a\b\c\d in directory "d" make a java file named Test.java inside the file pacakage a.b.c.d; class Test { public static void main(String [] argv){ //do not need to put anything, but maybe System.out } }//class Test end
When searching for source files, the directory must match the expected package or the type cannot be found. We generate an error so the user can correct this problem. We do not consider this to be a bug, but a case where we differ from javac.