Given the following source file: class A { Class a() { return A.class; } } gcj generates the following bytecode: 0: ldc #31=<String "A"> 2: invokestatic #33=<Method A.class$ (java.lang.String)java.lang.Class> 5: areturn whereas other java compilers (e.g. jikes) generate similar to: 0: getstatic #13=<Field A.class$A java.lang.Class> 3: dup 4: ifnonnull 18 7: pop 8: ldc #14=<String "[LA;"> 10: iconst_0 11: invokestatic #19=<Method A.class$ (java.lang.String,boolean)java.lang.Class 14: dup 15: putstatic #13=<Field A.class$A java.lang.Class> 18: areturn Note the A.class$A synthetic field which is absent from gcj output. The lossage is particularly noticable in libjava.lang/SyncTest.java.
I can confirm this on the mainline (200307008). Yes this would be a great benifit and speed.
This is an enhancement.
All gcj front end bugs have been fixed by the gcj-eclipse branch merge. I'm mass-closing the affected PRs. If you believe one of these was closed in error, please reopen it with a note explaining why. Thanks.