PsiMethod (@Nullable PsiClass targetClass, @Nullable PsiMethod generated) { if (generated == null || targetClass == null) return generated; if (JavaCodeStyleSettings.getInstance(targetClass.getContainingFile()).INSERT_OVERRIDE_ANNOTATION) { PsiMethod superMethod = targetClass.findMethodBySignature(generated, true); if (superMethod != null && superMethod.getContainingClass() != targetClass && PsiUtil.isAccessible(superMethod, targetClass, null)) { OverrideImplementUtil.annotateOnOverrideImplement(generated, targetClass, superMethod, true); } if (JavaPsiRecordUtil.getRecordComponentForAccessor(generated) != null) { AddAnnotationPsiFix .addPhysicalAnnotationIfAbsent(CommonClassNames.JAVA_LANG_OVERRIDE, PsiNameValuePair.EMPTY_ARRAY, generated.getModifierList()); } } return generated; }