private boolean useThisIdentifier(ClassTree body) { ThisIdentifierVisitor visitor = new ThisIdentifierVisitor(); body.accept(visitor); return visitor.usesThisIdentifier; }
@Override public void visitClass(ClassTree tree) { tree.accept(new ClassVisitor(context, this)); }
@Override public void visitNewClass(NewClassTree tree) { if (!ignoreAnonymousClass) { ClassTree classBody = tree.classBody(); if (null != classBody) { classBody.accept(new ClassVisitor(context, javaFileScanner)); } } }
@Override public void visitNode(Tree tree) { ClassTree classTree = (ClassTree) tree; Symbol.TypeSymbol classSymbol = classTree.symbol(); if (isInnerClass(classSymbol)) { methodInvocationVisitor.setClassSymbol(classSymbol); classTree.accept(methodInvocationVisitor); } }
private static boolean useThisInstance(ClassTree body) { UsesThisInstanceVisitor visitor = new UsesThisInstanceVisitor(body.symbol().type()); body.accept(visitor); return visitor.usesThisInstance; }
private static boolean useThisInstance(ClassTree body) { UsesThisInstanceVisitor visitor = new UsesThisInstanceVisitor(body.symbol().type()); body.accept(visitor); return visitor.usesThisInstance; }
@Override public void visitNode(Tree tree) { ClassTree classTree = (ClassTree) tree; Symbol.TypeSymbol classSymbol = classTree.symbol(); if (isInnerClass(classSymbol)) { methodInvocationVisitor.setClassSymbol(classSymbol); classTree.accept(methodInvocationVisitor); } }
@Override public void visitClass(ClassTree classTree) { if (hasSliceResourceAnnotation(classTree)) { GatherAnnotatedVariables gatherAnnotatedVariables = new GatherAnnotatedVariables(); classTree.accept(gatherAnnotatedVariables); annotatedVariables.addAll(gatherAnnotatedVariables.getAnnotatedVariables()); super.visitClass(classTree); } }
private static boolean isExtended(ClassTree classTree) { IsExtendedVisitor isExtendedVisitor = new IsExtendedVisitor(classTree.symbol().type().erasure()); classTree.accept(isExtendedVisitor); return isExtendedVisitor.isExtended; }
@Override public void visitNode(Tree tree) { ClassTree classTree = (ClassTree) tree; Symbol.TypeSymbol classSymbol = classTree.symbol(); if (classSymbol != null && isInnerClass(classSymbol) && !extendsOuterClass(classSymbol)) { classTree.accept(new MethodInvocationVisitor(classSymbol)); } }
@Override public void visitNode(Tree tree) { ClassTree classTree = (ClassTree) tree; Symbol.TypeSymbol classSymbol = classTree.symbol(); if (classSymbol != null && isInnerClass(classSymbol) && !extendsOuterClass(classSymbol)) { classTree.accept(new MethodInvocationVisitor(classSymbol)); } }
private static boolean isExtended(ClassTree classTree) { IsExtendedVisitor isExtendedVisitor = new IsExtendedVisitor(classTree.symbol().type().erasure()); classTree.accept(isExtendedVisitor); return isExtendedVisitor.isExtended; }
@Override public void visitNode(Tree tree) { ClassTree classTree = (ClassTree) tree; Symbol.TypeSymbol classSymbol = classTree.symbol(); if (classSymbol != null && isInnerClass(classSymbol) && !extendsOuterClass(classSymbol)) { classTree.accept(new MethodInvocationVisitor(classSymbol)); } }
@Override public void visitNode(Tree tree) { if (!hasSemantic()) { return; } ClassTree classTree = (ClassTree) tree; SymbolMetadata classMetadata = classTree.symbol().metadata(); Optional<AnnotationTree> sessionAttributesAnnotation = classTree.modifiers().annotations() .stream() .filter(a -> a.annotationType().symbolType().is("org.springframework.web.bind.annotation.SessionAttributes")) .findFirst(); if (sessionAttributesAnnotation.isPresent() && classMetadata.isAnnotatedWith("org.springframework.stereotype.Controller")) { MethodInvocationVisitor methodInvocationVisitor = new MethodInvocationVisitor(); classTree.accept(methodInvocationVisitor); if (!methodInvocationVisitor.setCompleteIsCalled) { reportIssue(sessionAttributesAnnotation.get().annotationType(), "Add a call to \"setComplete()\" on the SessionStatus object in a \"@RequestMapping\" method."); } } }
@Override public void visitNode(Tree tree) { if (!hasSemantic()) { return; } ClassTree classTree = (ClassTree) tree; SymbolMetadata classMetadata = classTree.symbol().metadata(); Optional<AnnotationTree> sessionAttributesAnnotation = classTree.modifiers().annotations() .stream() .filter(a -> a.annotationType().symbolType().is("org.springframework.web.bind.annotation.SessionAttributes")) .findFirst(); if (sessionAttributesAnnotation.isPresent() && classMetadata.isAnnotatedWith("org.springframework.stereotype.Controller")) { MethodInvocationVisitor methodInvocationVisitor = new MethodInvocationVisitor(); classTree.accept(methodInvocationVisitor); if (!methodInvocationVisitor.setCompleteIsCalled) { reportIssue(sessionAttributesAnnotation.get().annotationType(), "Add a call to \"setComplete()\" on the SessionStatus object in a \"@RequestMapping\" method."); } } }
@Override public void visitClass(ClassTree tree) { List<AnnotationTree> annotations = tree.modifiers().annotations(); for (AnnotationTree annotationTree : annotations) { if (isSearchedAnnotation(annotationTree, MODEL_ANNOTATION_FULL_NAME) && isOptionalDefaultValue(annotationTree.arguments())) { CheckIfOptionalAnnotationIsPresent checkIfOptionalIsPresent = new CheckIfOptionalAnnotationIsPresent( this); tree.accept(checkIfOptionalIsPresent); } } super.visitClass(tree); }
@Override public void visitNode(Tree tree) { if (!hasSemantic()) { return; } MethodTree methodTree = (MethodTree) tree; Symbol.TypeSymbol enclosingClass = methodTree.symbol().enclosingClass(); String className = enclosingClass.type().fullyQualifiedName(); MethodMatcher writeObjectMatcher = SerializableContract.writeObjectMatcher(className); if (writeObjectMatcher.matches(methodTree) && hasModifier(methodTree.modifiers(), SYNCHRONIZED)) { SynchronizationVisitor visitor = new SynchronizationVisitor(methodTree); enclosingClass.declaration().accept(visitor); if (!visitor.moreThanSingleLock) { reportIssue(ModifiersUtils.getModifier(methodTree.modifiers(), SYNCHRONIZED), "Remove this \"synchronized\" keyword."); } } }
@Override public void visitNode(Tree tree) { if (!hasSemantic()) { return; } MethodTree methodTree = (MethodTree) tree; Symbol.TypeSymbol enclosingClass = methodTree.symbol().enclosingClass(); String className = enclosingClass.type().fullyQualifiedName(); MethodMatcher writeObjectMatcher = SerializableContract.writeObjectMatcher(className); if (writeObjectMatcher.matches(methodTree) && hasModifier(methodTree.modifiers(), SYNCHRONIZED)) { SynchronizationVisitor visitor = new SynchronizationVisitor(methodTree); enclosingClass.declaration().accept(visitor); if (!visitor.moreThanSingleLock) { reportIssue(ModifiersUtils.getModifier(methodTree.modifiers(), SYNCHRONIZED), "Remove this \"synchronized\" keyword."); } } }