普通内部类和匿名内部类获得外部类字节码对象方式不一样。获得父类的字节码对象方法一样。
普通内部类:getDeclaringClass()
匿名内部类:getEnclosingClass()
WaterRiverBox waterRiverBox = new WaterRiverBox() {{
setType(1);
}};
WaterRiverBox.Test test = new WaterRiverBox.Test();
Class cur1=waterRiverBox.getClass();
Class<?> declaringClass = waterRiverBox.getClass().getDeclaringClass();
Class<?> declaringClass3 = waterRiverBox.getClass().getEnclosingClass();
Class<?> declaringClass2 = test.getClass().getDeclaringClass();
Class<?> superclass = waterRiverBox.getClass().getSuperclass();