#!/bin/sh rm -rf test mkdir test cat > test/Configuration.java <<EOF package test; public interface Configuration { boolean INIT_LOAD_LIBRARY = false; } EOF cat > test/Test.java <<EOF package test; import test.Configuration; public class Test { static { if (Configuration.INIT_LOAD_LIBRARY) { System.loadLibrary("gtkpeer"); } } } EOF gcj -C --classpath '' test/Test.java mv test/Test.class{,.fromsrc} gcj -C --classpath '' test/Configuration.java gcj -C --classpath '' test/Test.java mv test/Test.class{,.fromclass} jcf-dump -c test/Test.class.fromsrc > test/fromsrc jcf-dump -c test/Test.class.fromclass > test/fromclass diff -u test/from{src,class}
In libjava build unless --enable-libgcj-multifile is used this has the bad side effect that libgcj-4*.jar depends on the exact timing when doing make -jN build (e.g. GdkTextLayout.java and Configuration.java are compiled about at the same time, so if Configuration.java is compiled quickly enough GdkTextLayout.class will not be as optimized as it could be, while if Configuration.java compilation is tiny bit slower, GdkTextLayout.java's compilation will read Configuration.java and optimize the bool test out. -- Summary: Fields in interfaces not optimized when read from *.class, but optimized when read from *.java Product: gcc Version: 4.0.0 Status: UNCONFIRMED Severity: normal Priority: P2 Component: java AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: jakub at gcc dot gnu dot org CC: aph at gcc dot gnu dot org,gcc-bugs at gcc dot gnu dot org,java-prs at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21662