void (@NotNull PsiRequiresStatement statement, @NotNull Consumer<? super HighlightInfo.Builder> errorSink) { PsiModifierList modList = statement.getModifierList(); if (modList != null && PsiJavaModule.JAVA_BASE.equals(statement.getModuleName())) { PsiTreeUtil.processElements(modList, PsiKeyword.class, keyword -> { @PsiModifier.ModifierConstant String modifier = keyword.getText(); String message = JavaErrorBundle.message("modifier.not.allowed", modifier); HighlightInfo.Builder info = HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(keyword).descriptionAndTooltip(message); IntentionAction action = QuickFixFactory.getInstance().createModifierListFix(modList, modifier, false, false); info.registerFix(action, null, null, null, null); errorSink.accept(info); return true; }); } }