[Bug java/49556] New:=?UTF-8?Q?=20The=20import=20A=20cannot=20be=20resolved=EF=BC=8CBut=20the=20A=20is=20placed=20at=20the=20current=20dir?=.

licheng.1212 at gmail dot com gcc-bugzilla@gcc.gnu.org
Tue Jun 28 04:51:00 GMT 2011


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

           Summary: The import A cannot be resolved,But the A is placed at
                    the current dir.
           Product: gcc
           Version: 4.4.2
            Status: UNCONFIRMED
          Severity: blocker
          Priority: P3
         Component: java
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: licheng.1212@gmail.com


there is a test case:

[lee@localhost test]$ pwd
/home/lee/project/test
[lee@localhost test]$ ls
A.java  Main.java
[lee@localhost test]$ cat A.java 
public final class A {
    public void a()
    {
        System.out.println("A print");
    }
}
[lee@localhost test]$ cat Main.java 
import A;
class Main{
    public static void main(String args[])
    {
        A a=new A();
        a.a();
    }
}
[lee@localhost test]$ gcj --classpath=./ -c Main.java 
Main.java:1: error: The import A cannot be resolved
    import A;
           ^
1 problem (1 error)
[lee@localhost test]$ 

But when I change the A to a package,then it's OK

[lee@localhost test]$ tree
.
|-- Main.java
`-- pakfile
    `-- A.java

1 directory, 2 files
[lee@localhost test]$ cat pakfile/A.java 
package pakfile;
public final class A {
    public void a()
    {
        System.out.println("A print");
    }
}
[lee@localhost test]$ cat Main.java 
import pakfile.A;
class Main{
    public static void main(String args[])
    {
        A a=new A();
        a.a();
    }
}
[lee@localhost test]$ gcj --classpath=./ -c Main.java 
[lee@localhost test]$



More information about the Java-prs mailing list