void (PsiClass targetClass) { final PsiClassInitializer[] initializers = targetClass.getInitializers(); for (PsiClassInitializer initializer : initializers) { if (!initializer.hasModifierProperty(PsiModifier.STATIC)) initializer.delete(); } final PsiField[] fields = targetClass.getFields(); for (PsiField field : fields) { PsiExpression initializer = field.getInitializer(); if (!field.hasModifierProperty(PsiModifier.STATIC) && initializer != null) { initializer.delete(); } } }