@ClassVisitor public boolean checkClass(TypeDefinition td) { for(CustomAnnotation ca : td.getAnnotations()) { String name = ca.getAnnotationType().getInternalName(); if(name.equals("net/jcip/annotations/Immutable") || name.equals("javax/annotation/concurrent/Immutable")) return true; } return false; }
@Override protected void visitType(TypeDefinition td) { if (!td.isAnnotation()) return; DeclaredAnnotation da = getOrCreate(td); for (CustomAnnotation ca : td.getAnnotations()) { if (Types.is(ca.getAnnotationType(), Retention.class)) { for (AnnotationParameter ap : ca.getParameters()) { if (ap.getMember().equals("value")) { AnnotationElement value = ap.getValue(); if (value instanceof EnumAnnotationElement) { EnumAnnotationElement enumValue = (EnumAnnotationElement) value; if (Types.is(enumValue.getEnumType(), RetentionPolicy.class)) { da.policy = RetentionPolicy.valueOf(enumValue.getEnumConstantName()); } } } } } } }
public static Predicate<Warning> forType(TypeDefinition td) { Predicate<Warning> pred = forSuppressed(getSuppressed(td.getAnnotations())); if(pred == NO_PASS) return pred;
for (final CustomAnnotation annotation : type.getAnnotations()) { astType.getAnnotations().add(createAnnotation(annotation));
for (final CustomAnnotation annotation : type.getAnnotations()) { astType.getAnnotations().add(createAnnotation(annotation));
for (final CustomAnnotation annotation : type.getAnnotations()) { astType.getAnnotations().add(createAnnotation(annotation));