FilterPattern (@NotNull final Processor<? super LanguageLevel> processor) { return new FilterPattern(new ElementFilter() { @Override public boolean isAcceptable(Object element, @Nullable PsiElement context) { if (element instanceof PsiElement) { return processor.process(LanguageLevel.forElement((PsiElement)element)); } return false; } @Override public boolean isClassAcceptable(Class hintClass) { return true; } }); }