private boolean isJUnitTestableMetaAnnotated(Type type) { if (seenAnnotations.contains(type.fullyQualifiedName())) { return false; } seenAnnotations.add(type.fullyQualifiedName()); SymbolMetadata metadata = type.symbol().metadata(); if (metadata.isAnnotatedWith("org.junit.platform.commons.annotation.Testable")) { testAnnotations.add(type.fullyQualifiedName()); return true; } for (SymbolMetadata.AnnotationInstance annotation : metadata.annotations()) { if (isJUnitTestableMetaAnnotated(annotation.symbol().type())) { testAnnotations.add(type.fullyQualifiedName()); return true; } } return false; }
private boolean isJUnitTestableMetaAnnotated(Type type) { if (seenAnnotations.contains(type.fullyQualifiedName())) { return false; } seenAnnotations.add(type.fullyQualifiedName()); SymbolMetadata metadata = type.symbol().metadata(); if (metadata.isAnnotatedWith("org.junit.platform.commons.annotation.Testable")) { testAnnotations.add(type.fullyQualifiedName()); return true; } for (SymbolMetadata.AnnotationInstance annotation : metadata.annotations()) { if (isJUnitTestableMetaAnnotated(annotation.symbol().type())) { testAnnotations.add(type.fullyQualifiedName()); return true; } } return false; }
private static boolean isNotEJBAnnotated(Symbol symbol) { return symbol.metadata().annotations().stream().noneMatch(a -> a.symbol().owner().name().equals("javax.ejb")); }
private List<Symbol> metaAnnotations(Set<Type> knownTypes) { List<Symbol> result = new ArrayList<>(); for (AnnotationInstance annotationInstance : annotations) { Symbol annotationSymbol = annotationInstance.symbol(); Type annotationType = annotationSymbol.type(); if (!knownTypes.contains(annotationType)) { knownTypes.add(annotationType); result.add(annotationSymbol); result.addAll(((SymbolMetadataResolve) annotationSymbol.metadata()).metaAnnotations(knownTypes)); } } return new ArrayList<>(result); }
private static boolean differentAnnotations(SymbolMetadataResolve methodMetadata, SymbolMetadataResolve overrideeMetadata) { for (AnnotationInstance annotation : methodMetadata.annotations()) { Type type = annotation.symbol().type(); if (!type.is("java.lang.Override") && !overrideeMetadata.isAnnotatedWith(type.fullyQualifiedName())) { return true; } } return false; } }
private boolean isTestMethod(Symbol method) { return method.metadata().annotations().stream().anyMatch(input -> { Type type = input.symbol().type(); return type.isUnknown() || isTestAnnotation(type); }); }
private static boolean isServletOrEjb(Symbol symbol) { if (SERVLET_AND_EJB_CLASSES.stream().anyMatch(symbol.type()::isSubtypeOf)) { return true; } return symbol.metadata().annotations().stream().anyMatch(annotation -> annotation.symbol().type().fullyQualifiedName().startsWith("javax.ejb.")); }
@Override @CheckForNull public List<AnnotationValue> valuesForAnnotation(String fullyQualifiedNameOfAnnotation) { for (AnnotationInstance annotationInstance : annotations) { if(annotationInstance.symbol().type().is(fullyQualifiedNameOfAnnotation)) { return annotationInstance.values(); } } return null; } }
@Override @CheckForNull public List<AnnotationValue> valuesForAnnotation(String fullyQualifiedNameOfAnnotation) { for (AnnotationInstance annotationInstance : annotations) { if(annotationInstance.symbol().type().is(fullyQualifiedNameOfAnnotation)) { return annotationInstance.values(); } } return null; } }
private static boolean isNotEJBAnnotated(Symbol symbol) { return symbol.metadata().annotations().stream().noneMatch(a -> a.symbol().owner().name().equals("javax.ejb")); }
@Override public boolean isAnnotatedWith(String fullyQualifiedName) { for (AnnotationInstance annotationInstance : annotations) { if(annotationInstance.symbol().type().is(fullyQualifiedName)) { return true; } } return false; }
private static boolean isServletOrEjb(Symbol symbol) { if (SERVLET_AND_EJB_CLASSES.stream().anyMatch(symbol.type()::isSubtypeOf)) { return true; } return symbol.metadata().annotations().stream().anyMatch(annotation -> annotation.symbol().type().fullyQualifiedName().startsWith("javax.ejb.")); }
@Override public boolean isAnnotatedWith(String fullyQualifiedName) { for (AnnotationInstance annotationInstance : annotations) { if(annotationInstance.symbol().type().is(fullyQualifiedName)) { return true; } } return false; }
@Override @CheckForNull public List<AnnotationValue> valuesForAnnotation(String fullyQualifiedNameOfAnnotation) { for (AnnotationInstance annotationInstance : annotations) { if(annotationInstance.symbol().type().is(fullyQualifiedNameOfAnnotation)) { return annotationInstance.values(); } } return null; } }
private List<Symbol> metaAnnotations(Set<Type> knownTypes) { List<Symbol> result = new ArrayList<>(); for (AnnotationInstance annotationInstance : annotations) { Symbol annotationSymbol = annotationInstance.symbol(); Type annotationType = annotationSymbol.type(); if (!knownTypes.contains(annotationType)) { knownTypes.add(annotationType); result.add(annotationSymbol); result.addAll(((SymbolMetadataResolve) annotationSymbol.metadata()).metaAnnotations(knownTypes)); } } return new ArrayList<>(result); }
@Override @CheckForNull public List<AnnotationValue> valuesForAnnotation(String fullyQualifiedNameOfAnnotation) { for (AnnotationInstance annotationInstance : annotations) { if(annotationInstance.symbol().type().is(fullyQualifiedNameOfAnnotation)) { return annotationInstance.values(); } } return null; } }
private boolean isTestMethod(Symbol method) { return method.metadata().annotations().stream().anyMatch(input -> { Type type = input.symbol().type(); return type.isUnknown() || isTestAnnotation(type); }); }
@Override public boolean isAnnotatedWith(String fullyQualifiedName) { for (AnnotationInstance annotationInstance : annotations) { if(annotationInstance.symbol().type().is(fullyQualifiedName)) { return true; } } return false; }
@Override public boolean isAnnotatedWith(String fullyQualifiedName) { for (AnnotationInstance annotationInstance : annotations) { if(annotationInstance.symbol().type().is(fullyQualifiedName)) { return true; } } return false; }
private static boolean differentAnnotations(SymbolMetadataResolve methodMetadata, SymbolMetadataResolve overrideeMetadata) { for (AnnotationInstance annotation : methodMetadata.annotations()) { Type type = annotation.symbol().type(); if (!type.is("java.lang.Override") && !overrideeMetadata.isAnnotatedWith(type.fullyQualifiedName())) { return true; } } return false; } }