Search in sources :

Example 41 with VariableTree

use of org.sonar.plugins.java.api.tree.VariableTree in project sonar-java by SonarSource.

the class StringLiteralDuplicatedCheck method scanFile.

@Override
public void scanFile(JavaFileScannerContext context) {
    occurrences.clear();
    constants.clear();
    scan(context.getTree());
    for (String entry : occurrences.keySet()) {
        Collection<LiteralTree> literalTrees = occurrences.get(entry);
        int literalOccurrence = literalTrees.size();
        if (constants.containsKey(entry)) {
            VariableTree constant = constants.get(entry);
            List<LiteralTree> duplications = literalTrees.stream().filter(literal -> literal.parent() != constant).collect(Collectors.toList());
            context.reportIssue(this, duplications.iterator().next(), "Use already-defined constant '" + constant.simpleName() + "' instead of duplicating its value here.", secondaryLocations(duplications.subList(1, duplications.size())), literalOccurrence);
        } else if (literalOccurrence >= threshold) {
            context.reportIssue(this, literalTrees.iterator().next(), "Define a constant instead of duplicating this literal " + entry + " " + literalOccurrence + " times.", secondaryLocations(literalTrees), literalOccurrence);
        }
    }
}
Also used : ArrayListMultimap(com.google.common.collect.ArrayListMultimap) LiteralTree(org.sonar.plugins.java.api.tree.LiteralTree) Modifier(org.sonar.plugins.java.api.tree.Modifier) RuleProperty(org.sonar.check.RuleProperty) Collection(java.util.Collection) BaseTreeVisitor(org.sonar.plugins.java.api.tree.BaseTreeVisitor) JavaFileScanner(org.sonar.plugins.java.api.JavaFileScanner) HashMap(java.util.HashMap) Tree(org.sonar.plugins.java.api.tree.Tree) Multimap(com.google.common.collect.Multimap) ModifiersUtils(org.sonar.java.model.ModifiersUtils) Collectors(java.util.stream.Collectors) JavaFileScannerContext(org.sonar.plugins.java.api.JavaFileScannerContext) ExpressionTree(org.sonar.plugins.java.api.tree.ExpressionTree) VariableTree(org.sonar.plugins.java.api.tree.VariableTree) List(java.util.List) Map(java.util.Map) Rule(org.sonar.check.Rule) AnnotationTree(org.sonar.plugins.java.api.tree.AnnotationTree) MethodTree(org.sonar.plugins.java.api.tree.MethodTree) VariableTree(org.sonar.plugins.java.api.tree.VariableTree) LiteralTree(org.sonar.plugins.java.api.tree.LiteralTree)

Example 42 with VariableTree

use of org.sonar.plugins.java.api.tree.VariableTree in project sonar-java by SonarSource.

the class JavaTreeModelTest method type_arguments.

/**
 * 4.5.1. Type Arguments and Wildcards
 */
@Test
public void type_arguments() {
    VariableTree variableTree = (VariableTree) firstMethodFirstStatement("public class T { void m() { ClassType<? extends A, ? super B, ?, C> var; } }");
    assertThatChildrenIteratorHasSize(variableTree, 4);
    ParameterizedTypeTree parameterizedTypeTree = (ParameterizedTypeTree) variableTree.type();
    assertThatChildrenIteratorHasSize(parameterizedTypeTree, 2);
    TypeArguments typeArguments = parameterizedTypeTree.typeArguments();
    assertThat(typeArguments).hasSize(4);
    assertThat(typeArguments.separators()).hasSize(3);
    assertThatChildrenIteratorHasSize(typeArguments, 9);
    WildcardTree wildcard = (WildcardTree) typeArguments.get(0);
    assertThat(wildcard.is(Tree.Kind.EXTENDS_WILDCARD)).isTrue();
    assertThat(wildcard.bound()).isInstanceOf(IdentifierTree.class);
    assertThat(wildcard.queryToken()).isNotNull();
    assertThat(wildcard.queryToken().text()).isEqualTo("?");
    assertThat(wildcard.extendsOrSuperToken()).isNotNull();
    assertThat(wildcard.extendsOrSuperToken().text()).isEqualTo("extends");
    assertThatChildrenIteratorHasSize(wildcard, 3);
    wildcard = (WildcardTree) typeArguments.get(1);
    assertThat(wildcard.is(Tree.Kind.SUPER_WILDCARD)).isTrue();
    assertThat(wildcard.bound()).isInstanceOf(IdentifierTree.class);
    assertThat(wildcard.queryToken()).isNotNull();
    assertThat(wildcard.queryToken().text()).isEqualTo("?");
    assertThat(wildcard.extendsOrSuperToken()).isNotNull();
    assertThat(wildcard.extendsOrSuperToken().text()).isEqualTo("super");
    assertThatChildrenIteratorHasSize(wildcard, 3);
    wildcard = (WildcardTree) typeArguments.get(2);
    assertThat(wildcard.is(Tree.Kind.UNBOUNDED_WILDCARD)).isTrue();
    assertThat(wildcard.bound()).isNull();
    assertThat(wildcard.queryToken().text()).isEqualTo("?");
    assertThat(wildcard.queryToken()).isNotNull();
    assertThat(wildcard.extendsOrSuperToken()).isNull();
    assertThatChildrenIteratorHasSize(wildcard, 1);
    assertThat(typeArguments.get(3)).isInstanceOf(IdentifierTree.class);
    variableTree = (VariableTree) firstMethodFirstStatement("public class T { void m() { ClassType<@Foo ? extends A> var; } }");
    parameterizedTypeTree = (ParameterizedTypeTree) variableTree.type();
    assertThatChildrenIteratorHasSize(parameterizedTypeTree, 2);
    typeArguments = parameterizedTypeTree.typeArguments();
    assertThatChildrenIteratorHasSize(typeArguments, 3);
    wildcard = (WildcardTree) typeArguments.get(0);
    assertThat(wildcard.is(Tree.Kind.EXTENDS_WILDCARD)).isTrue();
    assertThat(wildcard.bound()).isInstanceOf(IdentifierTree.class);
    assertThat(wildcard.queryToken().text()).isEqualTo("?");
    assertThat(wildcard.annotations()).hasSize(1);
    assertThat(wildcard.extendsOrSuperToken().text()).isEqualTo("extends");
    assertThatChildrenIteratorHasSize(wildcard, 4);
    variableTree = (VariableTree) firstMethodFirstStatement("public class T { void m() { ClassType<? extends @Foo @Bar A> var; } }");
    parameterizedTypeTree = (ParameterizedTypeTree) variableTree.type();
    assertThatChildrenIteratorHasSize(parameterizedTypeTree, 2);
    typeArguments = parameterizedTypeTree.typeArguments();
    assertThatChildrenIteratorHasSize(typeArguments, 3);
    wildcard = (WildcardTree) typeArguments.get(0);
    assertThat(wildcard.is(Tree.Kind.EXTENDS_WILDCARD)).isTrue();
    assertThat(wildcard.bound()).isInstanceOf(IdentifierTree.class);
    assertThat(wildcard.annotations()).isEmpty();
    assertThat(wildcard.queryToken().text()).isEqualTo("?");
    assertThat(wildcard.extendsOrSuperToken().text()).isEqualTo("extends");
    assertThatChildrenIteratorHasSize(wildcard, 3);
}
Also used : ParameterizedTypeTree(org.sonar.plugins.java.api.tree.ParameterizedTypeTree) TypeArguments(org.sonar.plugins.java.api.tree.TypeArguments) VariableTree(org.sonar.plugins.java.api.tree.VariableTree) WildcardTree(org.sonar.plugins.java.api.tree.WildcardTree) Test(org.junit.Test)

Example 43 with VariableTree

use of org.sonar.plugins.java.api.tree.VariableTree in project sonar-java by SonarSource.

the class JavaTreeModelTest method array_creation_expression.

/**
 * 15.10. Array Creation Expressions
 */
@Test
public void array_creation_expression() {
    NewArrayTree tree = (NewArrayTree) expressionOfReturnStatement("class T { int[][] m() { return new int[][]{{1}, {2, 3}}; } }");
    assertThat(tree.is(Tree.Kind.NEW_ARRAY)).isTrue();
    assertThat(tree.type()).isNotNull();
    assertThat(tree.dimensions()).hasSize(2);
    assertThat(tree.initializers()).hasSize(2);
    assertThat(tree.initializers().separators()).hasSize(1);
    assertThat(tree.newKeyword()).isNotNull();
    assertThatChildrenIteratorHasSize(tree, 7);
    ArrayDimensionTree dimension = tree.dimensions().get(0);
    assertThat(dimension.is(Tree.Kind.ARRAY_DIMENSION)).isTrue();
    assertThat(dimension.annotations()).isEmpty();
    assertThat(dimension.openBracketToken().text()).isEqualTo("[");
    assertThat(dimension.expression()).isNull();
    assertThat(dimension.closeBracketToken().text()).isEqualTo("]");
    assertThatChildrenIteratorHasSize(dimension, 2);
    dimension = tree.dimensions().get(1);
    assertThat(dimension.is(Tree.Kind.ARRAY_DIMENSION)).isTrue();
    assertThat(dimension.annotations()).isEmpty();
    assertThat(dimension.openBracketToken().text()).isEqualTo("[");
    assertThat(dimension.expression()).isNull();
    assertThat(dimension.closeBracketToken().text()).isEqualTo("]");
    assertThatChildrenIteratorHasSize(dimension, 2);
    NewArrayTree firstDim = (NewArrayTree) tree.initializers().get(0);
    assertThat(firstDim.initializers()).hasSize(1);
    assertThat(firstDim.initializers().separators()).isEmpty();
    assertThatChildrenIteratorHasSize(firstDim, 3);
    NewArrayTree secondDim = (NewArrayTree) tree.initializers().get(1);
    assertThat(secondDim.initializers()).hasSize(2);
    assertThat(secondDim.initializers().separators()).hasSize(1);
    assertThatChildrenIteratorHasSize(secondDim, 3);
    tree = (NewArrayTree) expressionOfReturnStatement("class T { int[][] m() { return new int[2][2]; } }");
    assertThat(tree.is(Tree.Kind.NEW_ARRAY)).isTrue();
    assertThat(tree.type()).isNotNull();
    assertThat(tree.dimensions()).hasSize(2);
    assertThat(tree.initializers()).isEmpty();
    assertThat(tree.newKeyword()).isNotNull();
    assertThatChildrenIteratorHasSize(tree, 5);
    dimension = tree.dimensions().get(0);
    assertThat(dimension.is(Tree.Kind.ARRAY_DIMENSION)).isTrue();
    assertThat(dimension.annotations()).isEmpty();
    assertThat(dimension.openBracketToken().text()).isEqualTo("[");
    assertThat(dimension.expression().is(Tree.Kind.INT_LITERAL)).isTrue();
    assertThat(dimension.closeBracketToken().text()).isEqualTo("]");
    assertThatChildrenIteratorHasSize(dimension, 3);
    tree = (NewArrayTree) expressionOfReturnStatement("class T { int[][] m() { return new int[] @Bar [] {{}, {}}; } }");
    assertThat(tree.is(Tree.Kind.NEW_ARRAY)).isTrue();
    assertThat(tree.type()).isNotNull();
    assertThat(tree.dimensions()).hasSize(2);
    assertThat(tree.initializers()).hasSize(2);
    assertThat(tree.newKeyword()).isNotNull();
    assertThatChildrenIteratorHasSize(tree, 7);
    dimension = tree.dimensions().get(0);
    assertThat(dimension.is(Tree.Kind.ARRAY_DIMENSION)).isTrue();
    assertThat(dimension.annotations()).isEmpty();
    assertThat(dimension.openBracketToken().text()).isEqualTo("[");
    assertThat(dimension.expression()).isNull();
    assertThat(dimension.closeBracketToken().text()).isEqualTo("]");
    assertThatChildrenIteratorHasSize(dimension, 2);
    dimension = tree.dimensions().get(1);
    assertThat(dimension.is(Tree.Kind.ARRAY_DIMENSION)).isTrue();
    assertThat(dimension.annotations()).hasSize(1);
    assertThat(dimension.openBracketToken().text()).isEqualTo("[");
    assertThat(dimension.expression()).isNull();
    assertThat(dimension.closeBracketToken().text()).isEqualTo("]");
    assertThatChildrenIteratorHasSize(dimension, 3);
    tree = (NewArrayTree) expressionOfReturnStatement("class T { int[][] m() { return new int[2] @Bar []; } }");
    assertThat(tree.is(Tree.Kind.NEW_ARRAY)).isTrue();
    assertThat(tree.type()).isNotNull();
    assertThat(tree.dimensions()).hasSize(2);
    assertThat(tree.initializers()).isEmpty();
    assertThat(tree.newKeyword()).isNotNull();
    assertThatChildrenIteratorHasSize(tree, 5);
    dimension = tree.dimensions().get(0);
    assertThat(dimension.is(Tree.Kind.ARRAY_DIMENSION)).isTrue();
    assertThat(dimension.annotations()).isEmpty();
    assertThat(dimension.openBracketToken().text()).isEqualTo("[");
    assertThat(dimension.expression().is(Tree.Kind.INT_LITERAL)).isTrue();
    assertThat(dimension.closeBracketToken().text()).isEqualTo("]");
    assertThatChildrenIteratorHasSize(dimension, 3);
    dimension = tree.dimensions().get(1);
    assertThat(dimension.is(Tree.Kind.ARRAY_DIMENSION)).isTrue();
    assertThat(dimension.annotations()).hasSize(1);
    assertThat(dimension.openBracketToken().text()).isEqualTo("[");
    assertThat(dimension.expression()).isNull();
    assertThat(dimension.closeBracketToken().text()).isEqualTo("]");
    assertThatChildrenIteratorHasSize(dimension, 3);
    tree = (NewArrayTree) expressionOfReturnStatement("class T { int[] m() { return new int @Foo [2]; } }");
    assertThat(tree.is(Tree.Kind.NEW_ARRAY)).isTrue();
    assertThat(tree.type()).isNotNull();
    assertThat(tree.dimensions()).hasSize(1);
    assertThat(tree.initializers()).isEmpty();
    assertThat(tree.newKeyword()).isNotNull();
    assertThatChildrenIteratorHasSize(tree, 4);
    dimension = tree.dimensions().get(0);
    assertThat(dimension.is(Tree.Kind.ARRAY_DIMENSION)).isTrue();
    assertThat(dimension.annotations()).hasSize(1);
    assertThat(dimension.openBracketToken().text()).isEqualTo("[");
    assertThat(dimension.expression().is(Tree.Kind.INT_LITERAL)).isTrue();
    assertThat(dimension.closeBracketToken().text()).isEqualTo("]");
    assertThatChildrenIteratorHasSize(dimension, 4);
    tree = (NewArrayTree) ((VariableTree) firstMethodFirstStatement("class T { void m() { int[] a = {,}; } }")).initializer();
    assertThat(tree.is(Tree.Kind.NEW_ARRAY)).isTrue();
    assertThat(tree.type()).isNull();
    assertThat(tree.dimensions()).isEmpty();
    assertThat(tree.initializers()).isEmpty();
    assertThat(tree.initializers().separators()).hasSize(1);
}
Also used : NewArrayTree(org.sonar.plugins.java.api.tree.NewArrayTree) ArrayDimensionTree(org.sonar.plugins.java.api.tree.ArrayDimensionTree) VariableTree(org.sonar.plugins.java.api.tree.VariableTree) Test(org.junit.Test)

Example 44 with VariableTree

use of org.sonar.plugins.java.api.tree.VariableTree in project sonar-java by SonarSource.

the class JavaTreeModelTest method enum_field.

@Test
public void enum_field() {
    List<Tree> declarations = firstType("enum T { ; public int f1 = 42, f2[]; }").members();
    assertThat(declarations).hasSize(3);
    assertThat(declarations.get(0).is(Tree.Kind.EMPTY_STATEMENT)).isTrue();
    VariableTree tree = (VariableTree) declarations.get(1);
    assertThat(tree.is(Tree.Kind.VARIABLE)).isTrue();
    assertThat(tree.modifiers().modifiers()).hasSize(1);
    assertThat(tree.modifiers().modifiers().get(0).modifier()).isEqualTo(Modifier.PUBLIC);
    assertThat(tree.type()).isInstanceOf(PrimitiveTypeTree.class);
    assertThat(tree.simpleName().name()).isEqualTo("f1");
    assertThat(tree.initializer()).isNotNull();
    assertThatChildrenIteratorHasSize(tree, 6);
    tree = (VariableTree) declarations.get(2);
    assertThat(tree.is(Tree.Kind.VARIABLE)).isTrue();
    assertThat(tree.modifiers().modifiers()).hasSize(1);
    assertThat(tree.modifiers().modifiers().get(0).modifier()).isEqualTo(Modifier.PUBLIC);
    assertThatArrayTypeHasBrackets((ArrayTypeTree) tree.type());
    assertThat(tree.simpleName().name()).isEqualTo("f2");
    assertThat(tree.initializer()).isNull();
    assertThatChildrenIteratorHasSize(tree, 4);
}
Also used : VariableTree(org.sonar.plugins.java.api.tree.VariableTree) ImportClauseTree(org.sonar.plugins.java.api.tree.ImportClauseTree) BlockTree(org.sonar.plugins.java.api.tree.BlockTree) CompilationUnitTree(org.sonar.plugins.java.api.tree.CompilationUnitTree) SynchronizedStatementTree(org.sonar.plugins.java.api.tree.SynchronizedStatementTree) StaticInitializerTree(org.sonar.plugins.java.api.tree.StaticInitializerTree) TryStatementTree(org.sonar.plugins.java.api.tree.TryStatementTree) IfStatementTree(org.sonar.plugins.java.api.tree.IfStatementTree) CaseLabelTree(org.sonar.plugins.java.api.tree.CaseLabelTree) UnionTypeTree(org.sonar.plugins.java.api.tree.UnionTypeTree) MemberSelectExpressionTree(org.sonar.plugins.java.api.tree.MemberSelectExpressionTree) ArrayTypeTree(org.sonar.plugins.java.api.tree.ArrayTypeTree) TypeTree(org.sonar.plugins.java.api.tree.TypeTree) NewArrayTree(org.sonar.plugins.java.api.tree.NewArrayTree) ContinueStatementTree(org.sonar.plugins.java.api.tree.ContinueStatementTree) ExpressionStatementTree(org.sonar.plugins.java.api.tree.ExpressionStatementTree) ParameterizedTypeTree(org.sonar.plugins.java.api.tree.ParameterizedTypeTree) StatementTree(org.sonar.plugins.java.api.tree.StatementTree) TypeCastTree(org.sonar.plugins.java.api.tree.TypeCastTree) NewClassTree(org.sonar.plugins.java.api.tree.NewClassTree) AssignmentExpressionTree(org.sonar.plugins.java.api.tree.AssignmentExpressionTree) ClassTree(org.sonar.plugins.java.api.tree.ClassTree) UnaryExpressionTree(org.sonar.plugins.java.api.tree.UnaryExpressionTree) IdentifierTree(org.sonar.plugins.java.api.tree.IdentifierTree) PackageDeclarationTree(org.sonar.plugins.java.api.tree.PackageDeclarationTree) WildcardTree(org.sonar.plugins.java.api.tree.WildcardTree) LabeledStatementTree(org.sonar.plugins.java.api.tree.LabeledStatementTree) BreakStatementTree(org.sonar.plugins.java.api.tree.BreakStatementTree) ThrowStatementTree(org.sonar.plugins.java.api.tree.ThrowStatementTree) ExpressionTree(org.sonar.plugins.java.api.tree.ExpressionTree) ForStatementTree(org.sonar.plugins.java.api.tree.ForStatementTree) ParenthesizedTree(org.sonar.plugins.java.api.tree.ParenthesizedTree) VariableTree(org.sonar.plugins.java.api.tree.VariableTree) SwitchStatementTree(org.sonar.plugins.java.api.tree.SwitchStatementTree) ArrayDimensionTree(org.sonar.plugins.java.api.tree.ArrayDimensionTree) AssertStatementTree(org.sonar.plugins.java.api.tree.AssertStatementTree) EnumConstantTree(org.sonar.plugins.java.api.tree.EnumConstantTree) MethodReferenceTree(org.sonar.plugins.java.api.tree.MethodReferenceTree) AnnotationTree(org.sonar.plugins.java.api.tree.AnnotationTree) BinaryExpressionTree(org.sonar.plugins.java.api.tree.BinaryExpressionTree) ReturnStatementTree(org.sonar.plugins.java.api.tree.ReturnStatementTree) LiteralTree(org.sonar.plugins.java.api.tree.LiteralTree) ConditionalExpressionTree(org.sonar.plugins.java.api.tree.ConditionalExpressionTree) ImportTree(org.sonar.plugins.java.api.tree.ImportTree) PrimitiveTypeTree(org.sonar.plugins.java.api.tree.PrimitiveTypeTree) ModifierKeywordTree(org.sonar.plugins.java.api.tree.ModifierKeywordTree) TypeParameterTree(org.sonar.plugins.java.api.tree.TypeParameterTree) CaseGroupTree(org.sonar.plugins.java.api.tree.CaseGroupTree) Tree(org.sonar.plugins.java.api.tree.Tree) ArrayAccessExpressionTree(org.sonar.plugins.java.api.tree.ArrayAccessExpressionTree) WhileStatementTree(org.sonar.plugins.java.api.tree.WhileStatementTree) EmptyStatementTree(org.sonar.plugins.java.api.tree.EmptyStatementTree) MethodInvocationTree(org.sonar.plugins.java.api.tree.MethodInvocationTree) DoWhileStatementTree(org.sonar.plugins.java.api.tree.DoWhileStatementTree) LambdaExpressionTree(org.sonar.plugins.java.api.tree.LambdaExpressionTree) InstanceOfTree(org.sonar.plugins.java.api.tree.InstanceOfTree) CatchTree(org.sonar.plugins.java.api.tree.CatchTree) MethodTree(org.sonar.plugins.java.api.tree.MethodTree) Test(org.junit.Test)

Example 45 with VariableTree

use of org.sonar.plugins.java.api.tree.VariableTree in project sonar-java by SonarSource.

the class JavaTreeModelTest method class_field.

@Test
public void class_field() {
    List<Tree> declarations = firstType("class T { public int f1 = 42, f2[]; }").members();
    assertThat(declarations).hasSize(2);
    VariableTree tree = (VariableTree) declarations.get(0);
    assertThat(tree.is(Tree.Kind.VARIABLE)).isTrue();
    assertThat(tree.modifiers().modifiers()).hasSize(1);
    assertThat(tree.modifiers().modifiers().get(0).modifier()).isEqualTo(Modifier.PUBLIC);
    assertThat(tree.type()).isInstanceOf(PrimitiveTypeTree.class);
    assertThat(tree.simpleName().name()).isEqualTo("f1");
    assertThat(tree.initializer()).isNotNull();
    assertThat(tree.endToken()).isNotNull();
    assertThat(tree.endToken().text()).isEqualTo(",");
    assertThatChildrenIteratorHasSize(tree, 6);
    tree = (VariableTree) declarations.get(1);
    assertThat(tree.is(Tree.Kind.VARIABLE)).isTrue();
    assertThat(tree.modifiers().modifiers()).hasSize(1);
    assertThat(tree.modifiers().modifiers().get(0).modifier()).isEqualTo(Modifier.PUBLIC);
    assertThat(tree.type()).isInstanceOf(ArrayTypeTree.class);
    assertThatArrayTypeHasBrackets((ArrayTypeTree) tree.type());
    assertThat(tree.simpleName().name()).isEqualTo("f2");
    assertThat(tree.initializer()).isNull();
    assertThat(tree.endToken()).isNotNull();
    assertThat(tree.endToken().text()).isEqualTo(";");
    assertThatChildrenIteratorHasSize(tree, 4);
}
Also used : VariableTree(org.sonar.plugins.java.api.tree.VariableTree) ImportClauseTree(org.sonar.plugins.java.api.tree.ImportClauseTree) BlockTree(org.sonar.plugins.java.api.tree.BlockTree) CompilationUnitTree(org.sonar.plugins.java.api.tree.CompilationUnitTree) SynchronizedStatementTree(org.sonar.plugins.java.api.tree.SynchronizedStatementTree) StaticInitializerTree(org.sonar.plugins.java.api.tree.StaticInitializerTree) TryStatementTree(org.sonar.plugins.java.api.tree.TryStatementTree) IfStatementTree(org.sonar.plugins.java.api.tree.IfStatementTree) CaseLabelTree(org.sonar.plugins.java.api.tree.CaseLabelTree) UnionTypeTree(org.sonar.plugins.java.api.tree.UnionTypeTree) MemberSelectExpressionTree(org.sonar.plugins.java.api.tree.MemberSelectExpressionTree) ArrayTypeTree(org.sonar.plugins.java.api.tree.ArrayTypeTree) TypeTree(org.sonar.plugins.java.api.tree.TypeTree) NewArrayTree(org.sonar.plugins.java.api.tree.NewArrayTree) ContinueStatementTree(org.sonar.plugins.java.api.tree.ContinueStatementTree) ExpressionStatementTree(org.sonar.plugins.java.api.tree.ExpressionStatementTree) ParameterizedTypeTree(org.sonar.plugins.java.api.tree.ParameterizedTypeTree) StatementTree(org.sonar.plugins.java.api.tree.StatementTree) TypeCastTree(org.sonar.plugins.java.api.tree.TypeCastTree) NewClassTree(org.sonar.plugins.java.api.tree.NewClassTree) AssignmentExpressionTree(org.sonar.plugins.java.api.tree.AssignmentExpressionTree) ClassTree(org.sonar.plugins.java.api.tree.ClassTree) UnaryExpressionTree(org.sonar.plugins.java.api.tree.UnaryExpressionTree) IdentifierTree(org.sonar.plugins.java.api.tree.IdentifierTree) PackageDeclarationTree(org.sonar.plugins.java.api.tree.PackageDeclarationTree) WildcardTree(org.sonar.plugins.java.api.tree.WildcardTree) LabeledStatementTree(org.sonar.plugins.java.api.tree.LabeledStatementTree) BreakStatementTree(org.sonar.plugins.java.api.tree.BreakStatementTree) ThrowStatementTree(org.sonar.plugins.java.api.tree.ThrowStatementTree) ExpressionTree(org.sonar.plugins.java.api.tree.ExpressionTree) ForStatementTree(org.sonar.plugins.java.api.tree.ForStatementTree) ParenthesizedTree(org.sonar.plugins.java.api.tree.ParenthesizedTree) VariableTree(org.sonar.plugins.java.api.tree.VariableTree) SwitchStatementTree(org.sonar.plugins.java.api.tree.SwitchStatementTree) ArrayDimensionTree(org.sonar.plugins.java.api.tree.ArrayDimensionTree) AssertStatementTree(org.sonar.plugins.java.api.tree.AssertStatementTree) EnumConstantTree(org.sonar.plugins.java.api.tree.EnumConstantTree) MethodReferenceTree(org.sonar.plugins.java.api.tree.MethodReferenceTree) AnnotationTree(org.sonar.plugins.java.api.tree.AnnotationTree) BinaryExpressionTree(org.sonar.plugins.java.api.tree.BinaryExpressionTree) ReturnStatementTree(org.sonar.plugins.java.api.tree.ReturnStatementTree) LiteralTree(org.sonar.plugins.java.api.tree.LiteralTree) ConditionalExpressionTree(org.sonar.plugins.java.api.tree.ConditionalExpressionTree) ImportTree(org.sonar.plugins.java.api.tree.ImportTree) PrimitiveTypeTree(org.sonar.plugins.java.api.tree.PrimitiveTypeTree) ModifierKeywordTree(org.sonar.plugins.java.api.tree.ModifierKeywordTree) TypeParameterTree(org.sonar.plugins.java.api.tree.TypeParameterTree) CaseGroupTree(org.sonar.plugins.java.api.tree.CaseGroupTree) Tree(org.sonar.plugins.java.api.tree.Tree) ArrayAccessExpressionTree(org.sonar.plugins.java.api.tree.ArrayAccessExpressionTree) WhileStatementTree(org.sonar.plugins.java.api.tree.WhileStatementTree) EmptyStatementTree(org.sonar.plugins.java.api.tree.EmptyStatementTree) MethodInvocationTree(org.sonar.plugins.java.api.tree.MethodInvocationTree) DoWhileStatementTree(org.sonar.plugins.java.api.tree.DoWhileStatementTree) LambdaExpressionTree(org.sonar.plugins.java.api.tree.LambdaExpressionTree) InstanceOfTree(org.sonar.plugins.java.api.tree.InstanceOfTree) CatchTree(org.sonar.plugins.java.api.tree.CatchTree) MethodTree(org.sonar.plugins.java.api.tree.MethodTree) Test(org.junit.Test)

Aggregations

VariableTree (org.sonar.plugins.java.api.tree.VariableTree)86 MethodTree (org.sonar.plugins.java.api.tree.MethodTree)32 Tree (org.sonar.plugins.java.api.tree.Tree)32 IdentifierTree (org.sonar.plugins.java.api.tree.IdentifierTree)29 ClassTree (org.sonar.plugins.java.api.tree.ClassTree)27 Test (org.junit.Test)25 ExpressionTree (org.sonar.plugins.java.api.tree.ExpressionTree)22 Symbol (org.sonar.plugins.java.api.semantic.Symbol)18 MethodInvocationTree (org.sonar.plugins.java.api.tree.MethodInvocationTree)18 MemberSelectExpressionTree (org.sonar.plugins.java.api.tree.MemberSelectExpressionTree)17 AssignmentExpressionTree (org.sonar.plugins.java.api.tree.AssignmentExpressionTree)16 NewClassTree (org.sonar.plugins.java.api.tree.NewClassTree)13 List (java.util.List)12 CompilationUnitTree (org.sonar.plugins.java.api.tree.CompilationUnitTree)12 ReturnStatementTree (org.sonar.plugins.java.api.tree.ReturnStatementTree)12 BinaryExpressionTree (org.sonar.plugins.java.api.tree.BinaryExpressionTree)11 BlockTree (org.sonar.plugins.java.api.tree.BlockTree)11 StatementTree (org.sonar.plugins.java.api.tree.StatementTree)10 TypeTree (org.sonar.plugins.java.api.tree.TypeTree)10 Type (org.sonar.plugins.java.api.semantic.Type)9