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]

Re: java/4568: importing static inner classes fails


http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=4568

this also seems to be a problem when importing the outerclass and
then trying to refer to the innerclass without fully qualifying it:

---------------------
Foo.java:
package pkg;

public class Foo {
  public static class Inner {
    public void test() {
      System.out.println("footest");
    }
  }
}
--------------------
Bar.java:
package pkg;

import pkg.Foo;

public class Bar extends Foo.Inner {
  public void test() {
    System.out.println("bartest");
  }
}
--------------------

$ gcj -c pkg/*
pkg/Bar.java:5: Superclass `Foo.Inner' of class `pkg.Bar' not found.
   public class Bar extends Foo.Inner {
                            ^

adding the package name to the extends clause (pkg.Foo.Inner)
fixes things.  javac has no problem with this.  note that this
works fine if Foo is not in a package and is therefore already
fully qualified.

-MikeSalisbury


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