ClassMember[] (PsiClass aClass, Project project, Editor editor) { myEqualsFields = null; myHashCodeFields = null; myNonNullFields = PsiField.EMPTY_ARRAY; GlobalSearchScope scope = aClass.getResolveScope(); final PsiMethod equalsMethod = GenerateEqualsHelper.findMethod(aClass, GenerateEqualsHelper.getEqualsSignature(project, scope)); final PsiMethod hashCodeMethod = GenerateEqualsHelper.findMethod(aClass, GenerateEqualsHelper.getHashCodeSignature()); boolean needEquals = needToGenerateMethod(equalsMethod); boolean needHashCode = needToGenerateMethod(hashCodeMethod); if (!needEquals && !needHashCode) { String text = aClass instanceof PsiAnonymousClass ? JavaBundle.message("generate.equals.and.hashcode.already.defined.warning.anonymous") : JavaBundle.message("generate.equals.and.hashcode.already.defined.warning", aClass.getQualifiedName()); if (Messages.showYesNoDialog(project, text, JavaBundle.message("generate.equals.and.hashcode.already.defined.title"), Messages.getQuestionIcon()) == Messages.YES) { if (!WriteAction.compute(() -> { try { equalsMethod.delete(); hashCodeMethod.delete(); return Boolean.TRUE; } catch (IncorrectOperationException e) { LOG.error(e); return Boolean.FALSE; } }).booleanValue()) { return null; } else { needEquals = needHashCode = true; } } else { return null; } } boolean hasNonStaticFields = hasNonStaticFields(aClass); if (!hasNonStaticFields) { HintManager.getInstance().showErrorHint(editor, JavaBundle.message("generate.equals.no.fields.for.generation")); return null; } if (ApplicationManager.getApplication().isUnitTestMode()) { myEqualsFields = myHashCodeFields = aClass.getFields(); myNonNullFields = PsiField.EMPTY_ARRAY; } else { GenerateEqualsWizard wizard = new GenerateEqualsWizard(project, aClass, needEquals, needHashCode); if (!wizard.showAndGet()) { return null; } myEqualsFields = wizard.getEqualsFields(); myHashCodeFields = wizard.getHashCodeFields(); myNonNullFields = wizard.getNonNullFields(); } return DUMMY_RESULT; }