diff --git a/RegExpSupport/src/org/intellij/lang/regexp/psi/impl/RegExpPosixBracketExpressionImpl.java b/RegExpSupport/src/org/intellij/lang/regexp/psi/impl/RegExpPosixBracketExpressionImpl.java index 97bb04d0e028..e46593b2c44c 100644 --- a/RegExpSupport/src/org/intellij/lang/regexp/psi/impl/RegExpPosixBracketExpressionImpl.java +++ b/RegExpSupport/src/org/intellij/lang/regexp/psi/impl/RegExpPosixBracketExpressionImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 JetBrains s.r.o. + * Copyright 2000-2016 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,11 +16,9 @@ package org.intellij.lang.regexp.psi.impl; import com.intellij.lang.ASTNode; -import com.intellij.psi.PsiElementVisitor; import org.intellij.lang.regexp.RegExpTT; import org.intellij.lang.regexp.psi.RegExpElementVisitor; import org.intellij.lang.regexp.psi.RegExpPosixBracketExpression; -import org.jetbrains.annotations.NotNull; /** * @author Bas Leijdekkers @@ -39,5 +37,6 @@ public class RegExpPosixBracketExpressionImpl extends RegExpElementImpl implemen @Override public String getClassName() { final ASTNode nameNode = getNode().findChildByType(RegExpTT.NAME); - return nameNode != null ? nameNode.getText() : null; } + return nameNode != null ? nameNode.getText() : null; + } } diff --git a/RegExpSupport/src/org/intellij/lang/regexp/validation/RegExpAnnotator.java b/RegExpSupport/src/org/intellij/lang/regexp/validation/RegExpAnnotator.java index f713f6e6e638..d304053d9ace 100644 --- a/RegExpSupport/src/org/intellij/lang/regexp/validation/RegExpAnnotator.java +++ b/RegExpSupport/src/org/intellij/lang/regexp/validation/RegExpAnnotator.java @@ -380,8 +380,11 @@ public final class RegExpAnnotator extends RegExpElementVisitor implements Annot public void visitPosixBracketExpression(RegExpPosixBracketExpression posixBracketExpression) { final String className = posixBracketExpression.getClassName(); if (!POSIX_CHARACTER_CLASSES.contains(className)) { - final Annotation annotation = myHolder.createErrorAnnotation(posixBracketExpression, "Unknown POSIX character class"); - annotation.setHighlightType(ProblemHighlightType.LIKE_UNKNOWN_SYMBOL); + final ASTNode node = posixBracketExpression.getNode().findChildByType(RegExpTT.NAME); + if (node != null) { + final Annotation annotation = myHolder.createErrorAnnotation(node, "Unknown POSIX character class"); + annotation.setHighlightType(ProblemHighlightType.LIKE_UNKNOWN_SYMBOL); + } } }