PsiClassInitializer (PsiAnonymousClass aClass) { final PsiClassInitializer[] initializers = aClass.getInitializers(); if (initializers.length != 1) { return null; } final PsiClassInitializer initializer = initializers[0]; if (initializer.hasModifierProperty(PsiModifier.STATIC)) { return null; } if (aClass.getFields().length != 0 || aClass.getMethods().length != 0 || aClass.getInnerClasses().length != 0) { return null; } if (aClass.getBaseClassReference().resolve() == null) { return null; } return initializer; }