gcj/283: GCJ fails to compile inner classes which extend another inner class
Mark Wielaard
mark@klomp.org
Sat Jul 15 04:00:00 GMT 2000
The following reply was made to PR gcj/283; it has been noted by GNATS.
From: Mark Wielaard <mark@klomp.org>
To: idstewart@softhome.net
Cc: java-gnats@sourceware.cygnus.com
Subject: Re: gcj/283: GCJ fails to compile inner classes which extend another inner class
Date: Sat, 15 Jul 2000 12:51:51 +0200
Hi,
> > Note that in your example you try to extend InnerB from a non static
> > innerclass InnerA which is not legal. Making InnerA a public static class
> > would be a valid example.
>
> That, unfortunately, is not an option. I'm working on a clean-room
> implementation of Swing. Each of the core classes implement the Accessible
> interface by returning an inner class which extends
> JComponent.AccessibleJComponent, a protected abstract inner class.
I see what you are trying to do. You found (another) bug which is different
from gjc/256 (but which can only be shown when the gcj/256 patch is applied).
So to show this bug you have to not only extend the InnerA from InnerB
but also OuterB from OuterA:
public class OuterA {
public class InnerA {
}
}
public class OuterB extends OuterA {
public class InnerB extends OuterA.InnerA {
}
}
Now gcj will give the following error:
OuterB.java: In class `OuterB$InnerB':
OuterB.java: In method `<init>(OuterB)':
OuterB.java:4: No enclosing instance for inner class `OuterA$InnerA' is in scope; an explicit one must be provided when creating this inner class.
}
^
1 error
Which is wrong since OuterB is in scope and is an instance of OuterA.
Note that as Bryce noted you want to make sure that you don't have
any class files around since that gives yet another obscure error message.
Thanks,
Mark
P.S. Please CC java-gnats so your comments will make it into the bug database.
P.P.S. Where can I find this Swing clean room implementation?
Are you going to merge it with Classpath/libgcj?
More information about the Java-prs
mailing list