Search in sources :

Example 6 with LineColumn

use of com.puppycrawl.tools.checkstyle.api.LineColumn in project checkstyle by checkstyle.

the class AbstractJavadocCheck method visitToken.

@Override
public final void visitToken(DetailAST blockCommentNode) {
    if (JavadocUtil.isJavadocComment(blockCommentNode)) {
        // store as field, to share with child Checks
        context.get().blockCommentAst = blockCommentNode;
        final LineColumn treeCacheKey = new LineColumn(blockCommentNode.getLineNo(), blockCommentNode.getColumnNo());
        final ParseStatus result;
        if (TREE_CACHE.get().containsKey(treeCacheKey)) {
            result = TREE_CACHE.get().get(treeCacheKey);
        } else {
            result = context.get().parser.parseJavadocAsDetailNode(blockCommentNode);
            TREE_CACHE.get().put(treeCacheKey, result);
        }
        if (result.getParseErrorMessage() == null) {
            if (acceptJavadocWithNonTightHtml() || !result.isNonTight()) {
                processTree(result.getTree());
            }
            if (violateExecutionOnNonTightHtml && result.isNonTight()) {
                log(result.getFirstNonTightHtmlTag().getLine(), JavadocDetailNodeParser.MSG_UNCLOSED_HTML_TAG, result.getFirstNonTightHtmlTag().getText());
            }
        } else {
            final ParseErrorMessage parseErrorMessage = result.getParseErrorMessage();
            log(parseErrorMessage.getLineNumber(), parseErrorMessage.getMessageKey(), parseErrorMessage.getMessageArguments());
        }
    }
}
Also used : ParseStatus(com.puppycrawl.tools.checkstyle.JavadocDetailNodeParser.ParseStatus) LineColumn(com.puppycrawl.tools.checkstyle.api.LineColumn) ParseErrorMessage(com.puppycrawl.tools.checkstyle.JavadocDetailNodeParser.ParseErrorMessage)

Aggregations

LineColumn (com.puppycrawl.tools.checkstyle.api.LineColumn)6 ArrayList (java.util.ArrayList)2 Matcher (java.util.regex.Matcher)2 ParseErrorMessage (com.puppycrawl.tools.checkstyle.JavadocDetailNodeParser.ParseErrorMessage)1 ParseStatus (com.puppycrawl.tools.checkstyle.JavadocDetailNodeParser.ParseStatus)1 FileContents (com.puppycrawl.tools.checkstyle.api.FileContents)1 FileText (com.puppycrawl.tools.checkstyle.api.FileText)1 Pattern (java.util.regex.Pattern)1