void (@NotNull PsiElement element, final @NotNull AnnotationHolder holder) { // error checks element.accept(new JqlElementVisitor() { @Override public void visitEmptyValue(JqlEmptyValue emptyValue) { JqlSimpleClause clause = PsiTreeUtil.getParentOfType(emptyValue, JqlSimpleClause.class); if (clause != null && !isEmptyClause(clause)) { holder.newAnnotation(HighlightSeverity.ERROR, String.format(TaskBundle.message("inspection.message.not.expecting.s.here"), emptyValue.getText())).create(); } } @Override public void visitJqlList(JqlList list) { JqlSimpleClause clause = PsiTreeUtil.getParentOfType(list, JqlSimpleClause.class); if (clause != null && !isListClause(clause)) { holder.newAnnotation(HighlightSeverity.ERROR, TaskBundle.message("inspection.message.not.expecting.list.values.here")).create(); } } @Override public void visitJqlSimpleClause(JqlSimpleClause clause) { JqlOperand operand = clause.getOperand(); if (operand == null) { return; } boolean operandIsListLiteral = operand instanceof JqlList; boolean operandIsListFunction = false; if (operand instanceof JqlFunctionCall functionCall) { JqlStandardFunction standardFunction = JqlStandardFunction.byName(functionCall.getFunctionName().getText()); operandIsListFunction = standardFunction != null && standardFunction.hasMultipleResults(); } boolean hasListOperand = operandIsListLiteral || operandIsListFunction; if (isListClause(clause) && !hasListOperand) { holder.newAnnotation(HighlightSeverity.ERROR, TaskBundle.message("inspection.message.expecting.list.values.here")).range(operand).create(); } boolean hasEmptyOperand = operand instanceof JqlEmptyValue; if (isEmptyClause(clause) && !hasEmptyOperand) { holder.newAnnotation(HighlightSeverity.ERROR, TaskBundle.message("inspection.message.expecting.empty.or.null.here")).range(operand).create(); } } @Override public void visitJqlIdentifier(JqlIdentifier identifier) { TextAttributes attributes = CONSTANT.getDefaultAttributes(); if (attributes != null) { holder.newSilentAnnotation(HighlightSeverity.INFORMATION) .enforcedTextAttributes(attributes).create(); } } }); }