void (@NotNull PsiClass psiClass) { List<PsiField> annotatedFields = new ArrayList<>(); List<Pair<PsiField, PsiMethod>> instanceCandidates = new ArrayList<>(); List<Pair<PsiField, PsiMethod>> staticCandidates = new ArrayList<>(); for (PsiMethod method : psiClass.getMethods()) { processMethod(method, instanceCandidates, staticCandidates); } boolean isLombokAnnotationAtClassLevel = true; for (PsiField field : psiClass.getFields()) { PsiAnnotation annotation = field.getAnnotation(getAnnotationName()); if (annotation != null) { if (!annotation.getAttributes().isEmpty() || field.hasModifierProperty(PsiModifier.STATIC)) { isLombokAnnotationAtClassLevel = false; } else { annotatedFields.add(field); } } else if (!field.hasModifierProperty(PsiModifier.STATIC)) { boolean found = false; for (Pair<PsiField, PsiMethod> instanceCandidate : instanceCandidates) { if (field.equals(instanceCandidate.getFirst())) { found = true; break; } } isLombokAnnotationAtClassLevel = found; } if (!isLombokAnnotationAtClassLevel) { break; } } List<Pair<PsiField, PsiMethod>> allCandidates = new ArrayList<>(staticCandidates); if (isLombokAnnotationAtClassLevel && (!instanceCandidates.isEmpty() || !annotatedFields.isEmpty())) { warnOrFix(psiClass, instanceCandidates, annotatedFields); } else { allCandidates.addAll(instanceCandidates); } for (Pair<PsiField, PsiMethod> candidate : allCandidates) { warnOrFix(candidate.getFirst(), candidate.getSecond()); } }