void (@NotNull PsiField field) { final PsiClass aClass = field.getContainingClass(); if (aClass == null) { return; } final String fieldName = field.getName(); if (HardcodedMethodConstants.SERIAL_VERSION_UID.equals(fieldName)) { return; //special case } PsiClass ancestorClass = aClass.getSuperClass(); final Set<PsiClass> visitedClasses = new HashSet<>(); while (ancestorClass != null) { if (!visitedClasses.add(ancestorClass)) { return; } final PsiField ancestorField = ancestorClass.findFieldByName(fieldName, false); ancestorClass = ancestorClass.getSuperClass(); if (ancestorField == null) { continue; } if (m_ignoreInvisibleFields && !ClassUtils.isFieldVisible(ancestorField, aClass)) { continue; } if (ignoreStaticFields && field.hasModifierProperty(PsiModifier.STATIC) && ancestorField.hasModifierProperty(PsiModifier.STATIC)) { continue; } registerFieldError(field); return; } }