Get the annotations associated with given TestCase.
@param test the TestCase.
550101
private static Annotation[] getAnnotations(TestCase test) {
        try {
            Method m = test.getClass().getMethod(test.getName());
            return m.getDeclaredAnnotations();
        } catch (SecurityException e) {
        } catch (NoSuchMethodException e) {
        }
        return new Annotation[0];
    }
968362
public static Set<Annotation> buildQualifiers(Set<Annotation> annotations) {
        Set<Annotation> qualifiers = new HashSet<Annotation>(annotations);
        if (annotations.isEmpty()) {
            qualifiers.add(DefaultLiteral.INSTANCE);
        }
        qualifiers.add(AnyLiteral.INSTANCE);
        return qualifiers;
    }
203328
public static <T> T getAnnotation(final Class c, final Class<T> annotation) {
        final List<T> found = getAnnotations(c, annotation);
        if (found != null && !found.isEmpty()) {
            return found.get(0);
        } else {
            return null;
        }
    }
269550
private String getAction(final Annotation[] annotations, final Method method) {
        for (final Annotation annotation : annotations) {
            if (annotation instanceof Audit) {
                final Audit audit = (Audit) annotation;
                String action = audit.action();
                if (ACTION.equals(action)) {
                    return method.getName();
                } else {
                    return action;
                }
            }
        }
        return null;
    }
96634
public AnnotationInfo getAnnotationInfo(final String annotationClassName) {
        for(AnnotationInfo item : annotationInfos) {
            if(item.getClassName().equals(annotationClassName)) {
                return item;
            }
        }
        
        return null;
    }
591981
public static <A extends Annotation> A getAnnotation(final Class<A> annotation, final Method method) {
        try {
            return DaemonScanner.isAnnotationPresent(annotation, method.getDeclaringClass(), method.getName(), method.getParameterTypes());
        } catch(final NoSuchMethodException e) {
            return null;
        }
    }
414304
protected final List<Parameter> getParameters(Type type, List<Annotation> annotations) {
        return getParameters(type, annotations, typesToSkip);
    }
219675
@Override
    public List<AnnotationInfoImpl> getAnnotations() {
        if (annotations != null) {
            return annotations;
        }

        // Several cases where superclasses contribute no annotations.  In
        // each of these cases case, simply re-use the declared annotations
        // collection.
        //
        // (One case: All of the inheritable superclass annotations is
        // overridden by the immediate class, is not detected.)

        ClassInfoImpl useSuperClass = getSuperclass(); // Null for 'java.lang.Object'; null for interfaces.  
        if (useSuperClass == null) {
                annotations = declaredAnnotations;
            return annotations;
                    }

        // Retrieve *all* annotations of the superclass.  The effect
        // is to recurse across annotations of all superclasses.

        List<AnnotationInfoImpl> superAnnos = useSuperClass.getAnnotations();
        if (superAnnos.isEmpty()) {
            annotations = declaredAnnotations;
            return annotations;
                }

        Map<String, AnnotationInfoImpl> allAnnotations =
                        new HashMap<String, AnnotationInfoImpl>(superAnnos.size() + declaredAnnotations.size(), 1.0f);

        boolean sawInherited = false;
        for (AnnotationInfoImpl superAnno : superAnnos) {
            if (sawInherited = superAnno.isInherited()) {
                allAnnotations.put(superAnno.getAnnotationClassName(), superAnno);
            }
                }

        if (!sawInherited) {
            annotations = declaredAnnotations;
            return annotations;
        }

        // Make sure to add the declared annotations *after* adding the super class
        // annotations.  The immediate declared annotations have precedence.

        // We could test the number of overwritten annotations against the
        // number of inherited annotations.  That case seems infrequent, and
        // is not implemented.

        for (AnnotationInfoImpl declaredAnno : declaredAnnotations) {
            AnnotationInfoImpl overwrittenAnno = allAnnotations.put(declaredAnno.getAnnotationClassName(), declaredAnno);
            if (overwrittenAnno != null) {
                // NO-OP: But maybe we want to log this
            }
        }

        annotations = new ArrayList<AnnotationInfoImpl>(allAnnotations.values());
        return annotations;
    }
55495
public void visitAnnotations(AnnotatedNode node) {
        super.visitAnnotations(node);
        for (AnnotationNode annotation : node.getAnnotations()) {
            if (transforms.containsKey(annotation)) {
                targetNodes.add(new ASTNode[]{annotation, node});
            }
        }
    }
553938
private ImmutableSet<ASTAnnotation> getAnnotations(Annotation[] annotations) {

        ImmutableSet.Builder<ASTAnnotation> astAnnotationBuilder = ImmutableSet.builder();

        for (Annotation annotation : annotations) {
            astAnnotationBuilder.add(getAnnotation(annotation));
        }

        return astAnnotationBuilder.build();
    }
468555
public List<Annotation> getAllAnnotations() {
        List<Annotation> ret = new ArrayList<Annotation>();
        for (StatementGroup sg : statementGroups) {
            ret.addAll(sg.getAllAnnotations());
        }
        return ret;
    }
899815
public static List<Field> getAnnotatedFields(final Class<?> cls, final Class<? extends Annotation> annotationClass) {

        final List<Field> fieldList = new ArrayList<>();

        for (final Field f : cls.getDeclaredFields()) {
            if (f.getAnnotation(annotationClass) != null) {
                fieldList.add(f);
            }
        }

        // Add super class methods
        if (cls.getSuperclass() != null) {
            fieldList.addAll(getAnnotatedFields(cls.getSuperclass(), annotationClass));
        }

        return fieldList;
    }
384198
private Set<String> getTickets(RoxableTest methodAnnotation, RoxableTestClass classAnnotation) {
		return CollectionHelper.getTickets(configuration.getTickets(), methodAnnotation, classAnnotation);
	}
899958
private Set<Class<? extends Annotation>> getSupportedAnnotations() {
        Set<Class<? extends Annotation>> annotations = new LinkedHashSet<>();
        annotations.add(Remoter.class);
        return annotations;
    }
667205
public Set<Constructor> getConstructorsWithAnyParamAnnotated(Annotation annotation) {
        return filter(getConstructorsWithAnyParamAnnotated(annotation.annotationType()), withAnyParameterAnnotation(annotation));
    }
898693
private static List<Method> getMethodsWithAnnotation(Class<?> clazz, Class<? extends Annotation> annotation, Logger log) {
    List<Method> annotatedMethods = new ArrayList<Method>();
    Method classMethods[] = clazz.getDeclaredMethods();
    for(Method classMethod : classMethods) {
      if(classMethod.isAnnotationPresent(annotation) && classMethod.getParameterTypes().length == 0) {
        if(!containsMethod(classMethod, annotatedMethods)) {
          annotatedMethods.add(classMethod);
        }
      }
    }
    Collections.sort(annotatedMethods, new Comparator<Method> () {

      @Override
      public int compare(Method method1, Method method2) {
        return method1.getName().compareTo(method2.getName());
      }
    });
    return annotatedMethods;
  }
959812
public Annotation[] getAnnotations(final Method method) throws AnnotationReadException {
        
        final Class<?> clazz = method.getDeclaringClass();
        
        if(xmlInfo != null && xmlInfo.containsClassInfo(clazz.getName())) {
            final ClassInfo classInfo = xmlInfo.getClassInfo(clazz.getName());
            
            if(classInfo.containsMethodInfo(method.getName())) {
                final MethodInfo methodInfo = classInfo.getMethodInfo(method.getName());
                final Map<String, Annotation> map = new HashMap<>();
                
                if(methodInfo.isOverride()) {
                    for(Annotation ann : method.getAnnotations()) {
                        map.put(ann.annotationType().getName(), ann);
                    }
                }
                
                for(AnnotationInfo annInfo: methodInfo.getAnnotationInfos()){
                    try {
                        map.put(annInfo.getClassName(),
                                annotationBuilder.buildAnnotation(Class.forName(annInfo.getClassName()), annInfo));
                    } catch (ClassNotFoundException e) {
                        throw new AnnotationReadException(String.format("not found class '%s'", annInfo.getClassName()), e);
                    }
                }
                
                return map.values().toArray(new Annotation[map.size()]);
            }
        }
        return method.getAnnotations();
    }