gcc --version 2.96 (RedHat 7.0 Public Beta) gcc java does not understand static variables in inner class. gcj Y.java Y2.java -o x --main=Y2 Y2.java: In class `Y2': Y2.java: In method `main(java.lang.String[])': Y2.java:4: No variable `UU' defined in type `Y'. System.err.println(Y.UU.V); ^ 1 error cat Y2.java class Y2 { public static void main(String [] args) { System.err.println(Y.UU.V); } } cat Y.java public class Y { public static class UU { public static final String V="V"; } public static void main(String [] args) { System.err.println(Y.UU.V); } }
Should be fixed in http://gcc.gnu.org/ml/gcc-patches/2000-08/msg00516.html
The problem still exists in rpm -q gcc-java gcc-java-2.96-53 but the error message noe is different [mal@eth0_extrenal tgcc]$ gcj -c Y.java Y2.java Y2.java:4: Cannot find file for class Y$UU. but jikes is OK with this [mal@eth0_extrenal t2gcc]$ jikes Y.java Y2.java [mal@eth0_extrenal t2gcc]$ I will try contact Alexandre Petit-Bianco <apbianco> about this.
Also, if you compile it by other java compiler, so file Y$UU.class is created, then gcj works OK. Because of some reason it does not generate Y$UU.class by itself.
Confirmed OK in 8.0