void (PsiClass recordClass, Map<String, PsiRecordComponent> componentMap, PsiMethod method) { if (method.hasModifierProperty(PsiModifier.STATIC)) return; if (method.isConstructor()) { PsiMethod recordCtor = recordClass.findMethodBySignature(method, false); // Record constructor is generated with all component annotations, so we need to delete inappropriate ones if (recordCtor instanceof SyntheticElement) { for (PsiParameter parameter : method.getParameterList().getParameters()) { for (PsiAnnotation annotation : parameter.getAnnotations()) { if (AnnotationTargetUtil .findAnnotationTarget(annotation, PsiAnnotation.TargetType.PARAMETER, PsiAnnotation.TargetType.TYPE_USE) == null) { annotation.delete(); } } } } } else if (method.getParameterList().isEmpty()) { PsiRecordComponent component = componentMap.get(method.getName()); if (component != null) { PsiMethod recordMethod = recordClass.findMethodBySignature(method, false); if (recordMethod == null || recordMethod instanceof SyntheticElement) { copyAnnotations(method, component, PsiAnnotation.TargetType.METHOD); } if (method.findSuperMethods().length > 0) { AddAnnotationPsiFix .addPhysicalAnnotationIfAbsent(CommonClassNames.JAVA_LANG_OVERRIDE, PsiNameValuePair.EMPTY_ARRAY, method.getModifierList()); } else { PsiAnnotation override = method.getModifierList().findAnnotation(CommonClassNames.JAVA_LANG_OVERRIDE); if (override != null) { override.delete(); } } } } }