void (@NotNull PsiClass aClass) { final PsiElement parent = aClass.getParent(); final boolean interfaceMember = parent instanceof PsiClass && ((PsiClass)parent).isInterface(); final boolean redundantStrictfp = PsiUtil.isLanguageLevel17OrHigher(aClass) && aClass.hasModifierProperty(PsiModifier.STRICTFP); if (aClass.isRecord() || aClass.isInterface() || aClass.isEnum() || interfaceMember || redundantStrictfp) { PsiModifierList modifierList = aClass.getModifierList(); if (modifierList == null) { return; } final List<PsiKeyword> modifiers = PsiTreeUtil.getChildrenOfTypeAsList(modifierList, PsiKeyword.class); for (PsiKeyword modifier : modifiers) { final IElementType tokenType = modifier.getTokenType(); if (JavaTokenType.FINAL_KEYWORD == tokenType) { if (aClass.isRecord()) { // all records are implicitly final registerError(modifier, "unnecessary.record.modifier.problem.descriptor"); } } else if (JavaTokenType.ABSTRACT_KEYWORD == tokenType) { if (aClass.isInterface()) { // all interfaces are implicitly abstract registerError(modifier, "unnecessary.interface.modifier.problem.descriptor"); } } else if (JavaTokenType.STATIC_KEYWORD == tokenType) { if (parent instanceof PsiClass) { if (aClass.isRecord()) { // all inner records are implicitly static registerError(modifier, "unnecessary.inner.record.modifier.problem.descriptor"); } else if (aClass.isInterface()) { // all inner interfaces are implicitly static registerError(modifier, "unnecessary.inner.interface.modifier.problem.descriptor"); } else if (aClass.isEnum()) { // all inner enums are implicitly static registerError(modifier, "unnecessary.inner.enum.modifier.problem.descriptor"); } else if (interfaceMember) { // all inner classes of interfaces are implicitly static registerError(modifier, "unnecessary.interface.inner.class.modifier.problem.descriptor"); } } } else if (JavaTokenType.PUBLIC_KEYWORD == tokenType) { if (interfaceMember) { // all members of interfaces are implicitly public registerError(modifier, "unnecessary.interface.member.modifier.problem.descriptor"); } } else if (JavaTokenType.STRICTFP_KEYWORD == tokenType) { if (redundantStrictfp) { // all code is strictfp under Java 17 and higher registerError(modifier, "unnecessary.strictfp.modifier.problem.descriptor"); } } } } }