Java Code Examples for org.sonar.plugins.java.api.tree.ClassTree#members()
The following examples show how to use
org.sonar.plugins.java.api.tree.ClassTree#members() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BadConstantNameCheck.java From vjtools with Apache License 2.0 | 6 votes |
@Override public void visitNode(Tree tree) { ClassTree classTree = (ClassTree) tree; for (Tree member : classTree.members()) { if (member.is(Tree.Kind.VARIABLE) && hasSemantic()) { VariableTree variableTree = (VariableTree) member; Type symbolType = variableTree.type().symbolType(); if (isConstantType(symbolType) && (classTree.is(Tree.Kind.INTERFACE, Tree.Kind.ANNOTATION_TYPE) || isStaticFinal(variableTree))) { checkName(variableTree); } } // VJ Remove // // else if (member.is(Tree.Kind.ENUM_CONSTANT)) { // checkName((VariableTree) member); // } } }
Example 2
Source File: BadConstantNameCheck.java From vjtools with Apache License 2.0 | 6 votes |
@Override public void visitNode(Tree tree) { ClassTree classTree = (ClassTree) tree; for (Tree member : classTree.members()) { if (member.is(Tree.Kind.VARIABLE) && hasSemantic()) { VariableTree variableTree = (VariableTree) member; Type symbolType = variableTree.type().symbolType(); if (isConstantType(symbolType) && (classTree.is(Tree.Kind.INTERFACE, Tree.Kind.ANNOTATION_TYPE) || isStaticFinal(variableTree))) { checkName(variableTree); } } // VJ Remove // // else if (member.is(Tree.Kind.ENUM_CONSTANT)) { // checkName((VariableTree) member); // } } }
Example 3
Source File: CommonUtil.java From sonar-webdriver-plugin with MIT License | 5 votes |
public static List<AnnotationTree> getAnnotationTrees(ClassTree tree) { List<AnnotationTree> annotationTrees = new ArrayList<>(); List<Tree> members = tree.members(); for (Tree member : members) { if (METHOD_KIND.equals(member.kind().toString())) { annotationTrees.addAll(((MethodTree) member).modifiers().annotations()); } } return annotationTrees; }
Example 4
Source File: ThreadSafeFieldCheck.java From AEM-Rules-for-SonarQube with Apache License 2.0 | 4 votes |
private void checkMembers(ClassTree classTree) { for (Tree member : classTree.members()) { checkMember(member); } }