GCJ has a nasty bug where it mis-compiles files that contain duplicate class names vis: foo () { class C {} } bar () { class C {} } generating code where foo, is in fact manipulating bar's C class. To avoid the problem, reject .java files that contain duplicated class names.
Index: common/ChangeLog 2006-02-05 Andrew Cagney <cagney@redhat.com> * Makefile.rules (.java.o): Check and reject duplicate classes -- avoids a GCJ bug.
Red Hat bug: https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=171201 Gcc Bug: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24442