Class.getDeclaringClass() throws IllegalAccessError when called on an instance of Class representing java/awt/LightweightDispatcher. Please see an example below (reproducible with 1.4.0, 1.4.1, 1.4.2) The same example works correctly with 1.3.1 and returns null since java/awt/LightweightDispatcher is not an inner class.
public class A
public static void main(String args)
Class base = new java.awt.Container().getClass();
ObjectStreamClass ocs = ObjectStreamClass.lookup(base);
ObjectStreamField field = ocs.getField("dispatcher");
Class cls = field.getType();
System.out.println("Class type is "+cls.getName());
Class dcl = cls.getDeclaringClass();
System.out.println("Declaring class is "+dcl);
class type is java.awt.LightweightDispatcher
java.lang.IllegalAccessError: try to access class
sun.awt.dnd.SunDropTargetContextPeer$EventDispatcher from class
at java.lang.Class.getDeclaringClass(Native Method)
Looking at the code in the debugger, getDeclaringClass() finds that the inner_classes field is not empty. It then tries to access constant pool at the offset in inner_classes and fails. Since java/awt/LightweightDispatcher is not an inner class, it seems strange that inner_classes field is not empty.