congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
StatementTree.firstToken
Code IndexAdd Tabnine to your IDE (free)

How to use
firstToken
method
in
org.sonar.plugins.java.api.tree.StatementTree

Best Java code snippets using org.sonar.plugins.java.api.tree.StatementTree.firstToken (Showing top 5 results out of 315)

origin: SonarSource/sonar-java

 private void checkForReport(StatementTree statement, Tree startTree, Tree endTree, String name) {
  if (!(statement.is(Tree.Kind.BLOCK) || statement.firstToken().column() > startTree.firstToken().column())) {
   context.reportIssue(this, startTree, endTree,
    "Use indentation to denote the code conditionally executed by this \"" + name + "\".",
    Collections.singletonList(new JavaFileScannerContext.Location("", statement)), null);
  }
 }
}
origin: org.sonarsource.java/java-checks

 private void checkForReport(StatementTree statement, Tree startTree, Tree endTree, String name) {
  if (!(statement.is(Tree.Kind.BLOCK) || statement.firstToken().column() > startTree.firstToken().column())) {
   context.reportIssue(this, startTree, endTree,
    "Use indentation to denote the code conditionally executed by this \"" + name + "\".",
    Collections.singletonList(new JavaFileScannerContext.Location("", statement)), null);
  }
 }
}
origin: DarLiner/vjtools

private boolean isSameLine(IfStatementTree ifStmt) {
  StatementTree thenStmt = ifStmt.thenStatement();
  if (thenStmt.is(Tree.Kind.BLOCK)) {
    return false;
  }
  return ifStmt.firstToken().line() == thenStmt.firstToken().line();
}
origin: SonarSource/sonar-java

private void check(StatementTree current, StatementTree previous) {
 StatementTree block = null;
 boolean condition = false;
 if (previous.is(Tree.Kind.FOR_EACH_STATEMENT)) {
  block = ((ForEachStatement) previous).statement();
 } else if (previous.is(Tree.Kind.FOR_STATEMENT)) {
  block = ((ForStatementTree) previous).statement();
 } else if (previous.is(Tree.Kind.WHILE_STATEMENT)) {
  block = ((WhileStatementTree) previous).statement();
 } else if (previous.is(Tree.Kind.IF_STATEMENT)) {
  block = getIfStatementLastBlock(previous);
  condition = true;
 }
 if (block != null && !block.is(Tree.Kind.BLOCK)) {
  SyntaxToken previousToken = block.firstToken();
  int previousColumn = previousToken.column();
  int previousLine = previousToken.line();
  SyntaxToken currentToken = current.firstToken();
  int currentColumn = currentToken.column();
  int currentLine = currentToken.line();
  if ((previousColumn == currentColumn && previousLine + 1 == currentLine) ||
   (previousLine == previous.firstToken().line()
    && previous.firstToken().column() < currentColumn)) {
   int lines = 1 + currentLine - previousLine;
   context.reportIssue(this, current, getMessage(condition, lines));
  }
 }
}
origin: org.sonarsource.java/java-checks

private void check(StatementTree current, StatementTree previous) {
 StatementTree block = null;
 boolean condition = false;
 if (previous.is(Tree.Kind.FOR_EACH_STATEMENT)) {
  block = ((ForEachStatement) previous).statement();
 } else if (previous.is(Tree.Kind.FOR_STATEMENT)) {
  block = ((ForStatementTree) previous).statement();
 } else if (previous.is(Tree.Kind.WHILE_STATEMENT)) {
  block = ((WhileStatementTree) previous).statement();
 } else if (previous.is(Tree.Kind.IF_STATEMENT)) {
  block = getIfStatementLastBlock(previous);
  condition = true;
 }
 if (block != null && !block.is(Tree.Kind.BLOCK)) {
  SyntaxToken previousToken = block.firstToken();
  int previousColumn = previousToken.column();
  int previousLine = previousToken.line();
  SyntaxToken currentToken = current.firstToken();
  int currentColumn = currentToken.column();
  int currentLine = currentToken.line();
  if ((previousColumn == currentColumn && previousLine + 1 == currentLine) ||
   (previousLine == previous.firstToken().line()
    && previous.firstToken().column() < currentColumn)) {
   int lines = 1 + currentLine - previousLine;
   context.reportIssue(this, current, getMessage(condition, lines));
  }
 }
}
org.sonar.plugins.java.api.treeStatementTreefirstToken

Popular methods of StatementTree

  • is
  • accept
  • lastToken

Popular in Java

  • Reading from database using SQL prepared statement
  • getContentResolver (Context)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • setScale (BigDecimal)
  • BufferedImage (java.awt.image)
    The BufferedImage subclass describes an java.awt.Image with an accessible buffer of image data. All
  • String (java.lang)
  • TimeZone (java.util)
    TimeZone represents a time zone offset, and also figures out daylight savings. Typically, you get a
  • ExecutorService (java.util.concurrent)
    An Executor that provides methods to manage termination and methods that can produce a Future for tr
  • JarFile (java.util.jar)
    JarFile is used to read jar entries and their associated data from jar files.
  • BasicDataSource (org.apache.commons.dbcp)
    Basic implementation of javax.sql.DataSource that is configured via JavaBeans properties. This is no
  • Top plugins for Android Studio
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now