[forwarded from http://bugs.debian.org/369873] GCJ fails with Can't find default package 'core'. ... when a class source file specifies `import core.*'. A full example is outlined below. If you try to compile this `project' like gcj -d . src/Main.java src/core/Foo.java the above mentioned error is reported. The same project works fine with Sun's or Blackdown's Java compiler. Suppose we have the directory structure > find . ./src ./src/core ./src/core/Foo.java ./src/Main.java with the following contents of `src/Main.java': // commenting out this line makes the classes compile. import core.*; public class Main { public Main() { core.Foo foo = new core.Foo(); foo.print(); } public static void main(String args[]) { Main m = new Main(); } } and the following contents of `src/core/Foo.java': package core; public class Foo { public Foo() {} public void print() { System.out.println("Hello, world"); } }
Created attachment 12314 [details] example
Note that -d doesn't do anything when compiling to object. However, adding -C doesn't help either. A simple workaround is to add -Isrc. This is fixed on the gcj-eclipse branch, I marked this PR as depending on PR 28067. Perhaps gcj needs to handle -combine properly. That would also help fix this, I think.
All gcj front end bugs have been fixed by the gcj-eclipse branch merge. I'm mass-closing the affected PRs. If you believe one of these was closed in error, please reopen it with a note explaining why. Thanks.