void (@NotNull PsiField field) { final PsiClass containingClass = field.getContainingClass(); if (containingClass == null) { return; } if (containingClass.isInterface()) { final PsiModifierList modifierList = field.getModifierList(); final List<PsiKeyword> modifiers = PsiTreeUtil.getChildrenOfTypeAsList(modifierList, PsiKeyword.class); for (PsiKeyword modifier : modifiers) { final IElementType tokenType = modifier.getTokenType(); if (JavaTokenType.PUBLIC_KEYWORD == tokenType) { // all members of interfaces are implicitly public registerError(modifier, "unnecessary.interface.member.modifier.problem.descriptor"); } else if (JavaTokenType.STATIC_KEYWORD == tokenType || JavaTokenType.FINAL_KEYWORD == tokenType) { // all fields of interfaces are implicitly static and final registerError(modifier, "unnecessary.interface.field.modifier.problem.descriptor"); } } } else { // transient on interface field is a compile error if (field.hasModifierProperty(PsiModifier.STATIC) && field.hasModifierProperty(PsiModifier.TRANSIENT)) { final PsiModifierList modifierList = field.getModifierList(); final List<PsiKeyword> modifiers = PsiTreeUtil.getChildrenOfTypeAsList(modifierList, PsiKeyword.class); for (PsiKeyword modifier : modifiers) { // a transient modifier on a static field is a no-op if (JavaTokenType.TRANSIENT_KEYWORD == modifier.getTokenType()) { registerError(modifier, "unnecessary.transient.modifier.problem.descriptor"); } } } } }