@Override public void visitClass(ClassTree tree) { List<TypeTree> interfaces = tree.superInterfaces(); for (TypeTree typeTree : interfaces) { LOGGER.info("implements Interface : " + typeTree); if ("MySecurityInterface".equals(typeTree.toString())) { implementsSpecificInterface = Boolean.TRUE; } } super.visitClass(tree); }
private boolean isNotExtending(ClassTree tree) { return tree.superClass() == null && tree.superInterfaces().isEmpty(); } }
private static boolean hasNoExtension(ClassTree tree) { return tree.superInterfaces().isEmpty(); }
private static boolean isCloneable(ClassTree classTree) { return classTree.superInterfaces().stream().map(TypeTree::symbolType).anyMatch(t -> t.is("java.lang.Cloneable")); } }
private boolean implementsVulnerableInterface(ClassTree clazz) { boolean implementsInterface = false; for (TypeTree typeTree : clazz.superInterfaces()) { String name = typeTree.symbolType().fullyQualifiedName(); implementsInterface |= vulnerableInterfaces.contains(name); } return implementsInterface; }
@Override public void visitClass(ClassTree tree) { super.visitClass(tree); for (TypeTree parent : tree.superInterfaces()) { reportIssueIfDeprecatedType(parent); } }
private void checkExtending(ClassTree classTree, TypeTree currentInterfaceTree) { for (TypeTree superInterfaceTree : classTree.superInterfaces()) { if (!currentInterfaceTree.equals(superInterfaceTree) && SyntacticEquivalence.areEquivalent(currentInterfaceTree, superInterfaceTree)) { addIssue(superInterfaceTree, String.format(ERROR_MESSAGE, extractInterfaceName(currentInterfaceTree))); } } }
private boolean isCloneable(ClassTree classTree) { for (TypeTree superInterface : classTree.superInterfaces()) { if (superInterface.symbolType().is("java.lang.Cloneable")) { return true; } } return false; }
private static boolean isPartialImplementation(ClassTree tree) { return tree.superClass() != null || !tree.superInterfaces().isEmpty(); }
public void checkClassInterfaces(ClassTree tree) { List<InterfaceTreeAndStringPairReport> reportTreeAndStringInterfaces = tree.superInterfaces().stream() .map(typeTree -> matchFunctionalInterface(typeTree.symbolType()).map(rs -> new InterfaceTreeAndStringPairReport(rs, typeTree)).orElse(null)) .filter(Objects::nonNull) .collect(Collectors.toList()); if (reportTreeAndStringInterfaces.isEmpty()) { return; } List<JavaFileScannerContext.Location> secondaryLocations = reportTreeAndStringInterfaces.stream() .map(interf -> new JavaFileScannerContext.Location("", interf.classInterface)) .collect(Collectors.toList()); reportIssue(tree.simpleName(), reportMessage(reportTreeAndStringInterfaces), secondaryLocations, null); }
public void checkClassInterfaces(ClassTree tree) { List<InterfaceTreeAndStringPairReport> reportTreeAndStringInterfaces = tree.superInterfaces().stream() .map(typeTree -> matchFunctionalInterface(typeTree.symbolType()).map(rs -> new InterfaceTreeAndStringPairReport(rs, typeTree)).orElse(null)) .filter(Objects::nonNull) .collect(Collectors.toList()); if (reportTreeAndStringInterfaces.isEmpty()) { return; } List<JavaFileScannerContext.Location> secondaryLocations = reportTreeAndStringInterfaces.stream() .map(interf -> new JavaFileScannerContext.Location("", interf.classInterface)) .collect(Collectors.toList()); reportIssue(tree.simpleName(), reportMessage(reportTreeAndStringInterfaces), secondaryLocations, null); }
private void handleClassTree(ClassTree tree) { tree.superInterfaces().stream() .filter(superInterface -> INTERFACES.stream().anyMatch(superInterface.symbolType()::is)) .forEach(this::reportIssue); TypeTree superClass = tree.superClass(); if (superClass != null && superClass.symbolType().is(GLOBAL_METHOD_SECURITY_CONFIGURATION)) { reportIssue(superClass); } checkAnnotations(tree.modifiers(), JSR_250_ANNOTATIONS); }
private void handleClassTree(ClassTree tree) { tree.superInterfaces().stream() .filter(superInterface -> INTERFACES.stream().anyMatch(superInterface.symbolType()::is)) .forEach(this::reportIssue); TypeTree superClass = tree.superClass(); if (superClass != null && superClass.symbolType().is(GLOBAL_METHOD_SECURITY_CONFIGURATION)) { reportIssue(superClass); } checkAnnotations(tree.modifiers(), JSR_250_ANNOTATIONS); }
private void checkExtending(ClassTree classTree, Type currentInterfaceType, String currentInterfaceName) { for (TypeTree superInterfaceTree : classTree.superInterfaces()) { if (!currentInterfaceType.equals(superInterfaceTree.symbolType()) && currentInterfaceType.isSubtypeOf(superInterfaceTree.symbolType())) { String interfaceName = superInterfaceTree.symbolType().fullyQualifiedName(); addIssue(superInterfaceTree, String.format("\"%s\" is a \"%s\" so \"%s\" can be removed from the extension list.", currentInterfaceName, interfaceName, interfaceName)); } } }
@Override public void visitNode(Tree tree) { ClassTree classTree = (ClassTree) tree; if (!hasDeprecatedAnnotation(tree)) { checkSuperTypeDeprecation(classTree.superClass(), false); for (TypeTree superInterface : classTree.superInterfaces()) { checkSuperTypeDeprecation(superInterface, true); } } }
@Override public void visitClass(ClassTree classTree) { for (AnnotationTree annotation : classTree.modifiers().annotations()) { sliceAnnotationPresent |= TypeUtils.isOfType(annotation.annotationType(), SLICE_RESOURCE_ANNOTATION); } for (TypeTree typeTree : classTree.superInterfaces()) { implementedInitializableModel |= TypeUtils.isOfType(typeTree, INITIALIZABLE_MODEL_INTERFACE); } super.visitClass(classTree); }
@Override public void visitClass(ClassTree tree) { scan(tree.modifiers()); scan(tree.typeParameters()); scan(tree.superClass()); scan(tree.superInterfaces()); scan(tree.members()); }
@Override public void visitClass(ClassTree tree) { scan(tree.modifiers()); scan(tree.typeParameters()); scan(tree.superClass()); scan(tree.superInterfaces()); scan(tree.members()); }
@Override public void visitClass(ClassTree tree) { scan(tree.modifiers()); scan(tree.simpleName()); scan(tree.typeParameters()); scan(tree.superClass()); scan(tree.superInterfaces()); scan(tree.members()); }
@Override public void visitClass(ClassTree tree) { scan(tree.modifiers()); scan(tree.simpleName()); scan(tree.typeParameters()); scan(tree.superClass()); scan(tree.superInterfaces()); scan(tree.members()); }