This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug java/19173] New: problems resolving classes


GCJ appears to have a problem with statement 'import <package>.*' 
in  case  all  files  to  be  imporated are given as compilation 
arguments. The very same works fine using SUN's javac compiler.

{* Upps, how can I upload  something here? Anyway, the whole sub-
ject has been investigated by Tom (tromey@redhat.com) and a small
demo project has been sent. *}

Here's a literal description of the demo project: This
are the project files:

 $ tar zxvf xxx.tgz
 xxx/
 xxx/impl/
 xxx/impl/Echo.java
 xxx/hello.java

This is the file's contents: 

================ hello.java =============================
package greeting;

import greeting.impl.*;

public class hello {
  static Echo myecho;
}
================ Echo.java ==============================
package greeting.impl;
public class Echo {}
========================================================

Now I'm going to compile the whole package in one shot:

 $ cd xxx
 javac -d . -C hello.java impl/Echo.java   # ok

=>> Works fine!

Remove files created by 'javac':

 $ rm -rf greeting

Try to compile the very same using gcj:

 $ gcj -d . -C hello.java impl/Echo.java 
 hello.java:3: error: Can't find default package `greeting.impl'. \
 Check the CLASSPATH environment variable and the access to the archives
 1 error

The problem appears to be related to 

 import hello.impl.*;

in hello.java. When changing to read

 import hello.impl.Echo ;

compilation using gcj works fine. Another option is to 
rename directory "xxx" into "greeting" and to use -I ..,
ie.

 $ cd ..
 $ mv xxx greeting
 $ cd greeting
 $ gcj -d . -I .. -C hello.java impl/Echo.java

-- 
           Summary: problems resolving classes
           Product: gcc
           Version: 3.4.3
            Status: UNCONFIRMED
          Severity: critical
          Priority: P2
         Component: java
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: ora dot et dot labora at web dot de
                CC: gcc-bugs at gcc dot gnu dot org,java-prs at gcc dot gnu
                    dot org,tromey at redhat dot com
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19173


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]