void (@NotNull PsiClass aClass) { PsiElementFactory factory = JavaPsiFacade.getElementFactory(myProject); CodeStyleManager codeStyleManager = CodeStyleManager.getInstance(myProject); final PsiNewExpression newExpression = (PsiNewExpression) myAnonOrLocalClass.getParent(); PsiExpressionList argList = newExpression.getArgumentList(); assert argList != null; PsiExpression[] originalExpressions = argList.getExpressions(); final PsiMethod superConstructor = newExpression.resolveConstructor(); final PsiReferenceList superConstructorThrowsList = superConstructor != null && superConstructor.getThrowsList().getReferencedTypes().length > 0 ? superConstructor.getThrowsList() : null; if (myVariableInfos.length > 0 || originalExpressions.length > 0 || superConstructorThrowsList != null) { PsiMethod constructor = factory.createConstructor(); if (superConstructorThrowsList != null) { constructor.getThrowsList().replace(superConstructorThrowsList); } if (originalExpressions.length > 0) { createSuperStatement(constructor, originalExpressions); } if (myVariableInfos.length > 0) { fillParameterList(constructor); createAssignmentStatements(constructor); appendInitializers(constructor); } constructor = (PsiMethod) codeStyleManager.reformat(constructor); aClass.add(constructor); } }