Bug 29194 - fails to import package from project
Summary: fails to import package from project
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: java (show other bugs)
Version: 4.1.2
: P3 normal
Target Milestone: 4.3.0
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on: 28067
Blocks:
  Show dependency treegraph
 
Reported: 2006-09-23 17:18 UTC by Debian GCC Maintainers
Modified: 2007-01-09 20:48 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2006-09-23 22:33:23


Attachments
example (523 bytes, application/x-compressed-tar)
2006-09-23 17:18 UTC, Debian GCC Maintainers
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Debian GCC Maintainers 2006-09-23 17:18:12 UTC
[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");
      }
  }
Comment 1 Debian GCC Maintainers 2006-09-23 17:18:48 UTC
Created attachment 12314 [details]
example
Comment 2 Tom Tromey 2006-09-23 22:33:23 UTC
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.
Comment 3 Tom Tromey 2007-01-09 20:48:51 UTC
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.