void (@NotNull PsiField field) { 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 = ClassUtils.getContainingClass(aClass); while (ancestorClass != null) { final PsiField ancestorField = ancestorClass.findFieldByName(fieldName, false); if (ancestorField != null) { if (!m_ignoreInvisibleFields || ancestorField.hasModifierProperty(PsiModifier.STATIC) || !CommonJavaRefactoringUtil.isInStaticContext(aClass, ancestorClass)) { registerFieldError(field); } } aClass = ancestorClass; ancestorClass = ClassUtils.getContainingClass(aClass); } }