[Bug java/18119] New: GCJ imports inner classes too eagarly
csm at gnu dot org
gcc-bugzilla@gcc.gnu.org
Sat Oct 23 00:50:00 GMT 2004
GCJ erroneously looks up inner classes (usually private) before classes in other
packages.
For example, I have three files a/A.java, b/B.java, and b/C.java:
-- a/A.java:
package a;
public abstract class A
{
public abstract void a();
public void b()
{
new B().innerB();
}
private class B
{
public void innerB()
{
System.out.println ("inner b!");
}
}
}
-- b/B.java:
package b;
class B
{
public void b()
{
System.out.println ("b!");
}
}
-- b/C.java:
package b;
import a.A;
class C extends A
{
public void a()
{
System.out.println ("aaa!");
}
public static final void main (String[] argv)
{
C c = new C();
c.a();
c.b();
B b = new B();
b.b();
}
}
$ gcj -C a/A.java b/B.java b/C.java
b/C.java:15: error: Nested class a.A$B is private; cannot be accessed from here.
B b = new B();
^
1 error
$ gcj --version
gcj (GCC) 3.4.2
This is easy to work around (just say "b.B b = new b.B()"), but is still
incorrect. Javac and jikes do not fail.
--
Summary: GCJ imports inner classes too eagarly
Product: gcc
Version: 3.4.2
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: java
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: csm at gnu dot org
CC: gcc-bugs at gcc dot gnu dot org,java-prs at gcc dot gnu
dot org
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=18119
More information about the Java-prs
mailing list