This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Re: frontend bug -- inner classes
- From: Bryce McKinlay <bryce at waitaki dot otago dot ac dot nz>
- To: Adam Megacz <gcj at lists dot megacz dot com>
- Cc: java at gcc dot gnu dot org
- Date: Fri, 01 Feb 2002 13:29:19 +1300
- Subject: Re: frontend bug -- inner classes
- References: <86lmee5asi.fsf@megacz.com>
Adam Megacz wrote:
>This should not compile, yet it does. Note that x is not static, yet
>main() is.
>
>public class t {
> int x = 0;
> public static void main() {
> new Thread() {
> public void run() {
> x = 5;
> }
> }.start();
> }
>}
>
>javac gives this error:
>
>t.java:6: non-static variable x cannot be referenced from a static context
> x = 5;
> ^
>
I have a fix for this (check the java-patches archives) but it causes
some other problems - specifically, anonymous classes should never be
ACC_STATIC, even though we need to treat it as such when declared in a
static context.
Sometime soon I'll take another look at it.
regards
Bryce.