gcj/255: Fields can be static in an inner class when they are final
mark@klomp.org
mark@klomp.org
Thu Jun 8 13:50:00 GMT 2000
>Number: 255
>Category: gcj
>Synopsis: Fields can be static in an inner class when they are final
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: apbianco
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu Jun 08 13:50:00 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator: mark@klomp.org
>Release: gcc version 2.96 20000602 (experimental)
>Organization:
>Environment:
>Description:
A field in an inner class can be static if it is final.
The following should compile, but doesn't:
public class A {
public static void main(String args[]) {
System.out.println(B.Hello.WORLD);
}
}
class B {
class Hello {
public static final String WORLD = "Hello World!";
}
}
Compiling with gjc --main=A A.java gives:
A.java:9: Field `WORLD' can't be static in innerclass `B$Hello'. Only members of interfaces and top-level classes can be static.
public static final String WORLD = "Hello World!";
^
1 error
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the Java-prs
mailing list