Class.getEnclosingClass() returns null on enclosed class. Specifically:
c = class org.freedesktop.DBus$Local$Disconnected c.getEnclosingClass() = null (followed by a null pointer exception on the next line) Code which prints that: if (Debug.debug) Debug.print(Debug.VERBOSE, "c = "+c); if (Debug.debug) Debug.print(Debug.VERBOSE, "c.getEnclosingClass() = "+c.getEnclosingClass()); if (Debug.debug) Debug.print(Debug.VERBOSE, "c.getEnclosingClass().getAnnotation(DBusInterfaceName.class) = "+c.getEnclosingClass().getAnnotation(DBusInterfaceName.class)); if (null != c.getEnclosingClass().getAnnotation(DBusInterfaceName.class)) Source for DBus$Local$Disconnected: public interface DBus extends DBusInterface { .... /** * Messages generated locally in the application. */ public interface Local extends DBusInterface { public class Disconnected extends DBusSignal { public Disconnected(String path) throws DBusException { super(path); } } } .... } GCC version: gcc (GCC) 4.2.3 20071123 (prerelease) (Debian 4.2.2-4) (Also happens in 4.2.2) This code works as expected in Sun JDK 5 and 6 Matt -- Summary: Class.getEnclosingClass() returns null on enclosed class Product: gcc Version: 4.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: java AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: gcc-bugzilla at matthew dot ath dot cx GCC build triplet: i486-linux-gnu GCC host triplet: i486-linux-gnu GCC target triplet: i486-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34444