@Override public int getLine() { return parameters.openParenToken().getLine(); }
@Override public int getLine() { return parameters.openParenToken().getLine(); }
@Override public void visitToken(SyntaxToken syntaxToken) { InternalSyntaxToken internalSyntaxToken = (InternalSyntaxToken) syntaxToken; if(!internalSyntaxToken.isEOF()) { lines.add(internalSyntaxToken.getLine()); } } }
@Override public int getLine() { return parameters.openParenToken().getLine(); }
@Override public int getLine() { return parameters.openParenToken().getLine(); }
@Override public void visitToken(SyntaxToken token) { InternalSyntaxToken internalSyntaxToken = (InternalSyntaxToken) token; if (internalSyntaxToken.isEOF()) { int lines = internalSyntaxToken.getLine(); if (lines > maximum) { addIssueOnFile(MessageFormat.format("This file has {0} lines, which is greater than {1} authorized. Split it into smaller files.", lines, maximum)); } } } }
public void ignoreLines(CompilationUnitTree tree) { if (!tree.imports().isEmpty()) { int start = ((InternalSyntaxToken) tree.imports().get(0).importKeyword()).getLine(); int end = ((InternalSyntaxToken) tree.imports().get(tree.imports().size() - 1).semicolonToken()).getLine(); for (int i = start; i <= end; i++) { ignoredLines.add(i); } } }
@Override public void visitToken(SyntaxToken syntaxToken) { int tokenLine = ((InternalSyntaxToken) syntaxToken).getLine(); if (tokenLine != previousTokenLine) { for (SyntaxTrivia trivia : syntaxToken.trivias()) { if (((InternalSyntaxTrivia)trivia).getLine() == previousTokenLine) { String comment = trivia.comment(); comment = comment.startsWith("//") ? comment.substring(2) : comment.substring(2, comment.length() - 2); comment = comment.trim(); if (!pattern.matcher(comment).matches() && !containsExcludedPattern(comment)) { addIssue(previousTokenLine, "Move this trailing comment on the previous empty line."); } } } } previousTokenLine = tokenLine; }
private void handleSuppressWarning(ClassTree tree) { int endLine = ((InternalSyntaxToken) tree.closeBraceToken()).getLine(); handleSuppressWarning(tree.modifiers().annotations(), endLine); }
private void handleSuppressWarning(MethodTree tree) { int endLine = ((JavaTree) tree.simpleName()).getLine(); // if we have no block, then we assume method is on one line on the method name line. if (tree.block() != null) { endLine = ((InternalSyntaxToken) tree.block().closeBraceToken()).getLine(); } handleSuppressWarning(tree.modifiers().annotations(), endLine); }