/** * Constructs an instance. * * @param annotations {@code non-null;} set of annotations */ public AnnotationSetItem(Annotations annotations) { super(ALIGNMENT, writeSize(annotations)); this.annotations = annotations; this.items = new AnnotationItem[annotations.size()]; int at = 0; for (Annotation a : annotations.getAnnotations()) { items[at] = new AnnotationItem(a); at++; } }
/** * Constructs an instance. * * @param annotations {@code non-null;} set of annotations */ public AnnotationSetItem(Annotations annotations) { super(ALIGNMENT, writeSize(annotations)); this.annotations = annotations; this.items = new AnnotationItem[annotations.size()]; int at = 0; for (Annotation a : annotations.getAnnotations()) { items[at] = new AnnotationItem(a); at++; } }
/** * Constructs an instance. * * @param annotations {@code non-null;} set of annotations * @param dexFile {@code non-null;} dex output */ public AnnotationSetItem(Annotations annotations, DexFile dexFile) { super(ALIGNMENT, writeSize(annotations)); this.annotations = annotations; this.items = new AnnotationItem[annotations.size()]; int at = 0; for (Annotation a : annotations.getAnnotations()) { items[at] = new AnnotationItem(a, dexFile); at++; } }
/** * Constructs an instance. * * @param annotations {@code non-null;} set of annotations * @param dexFile {@code non-null;} dex output */ public AnnotationSetItem(Annotations annotations, DexFile dexFile) { super(ALIGNMENT, writeSize(annotations)); this.annotations = annotations; this.items = new AnnotationItem[annotations.size()]; int at = 0; for (Annotation a : annotations.getAnnotations()) { items[at] = new AnnotationItem(a, dexFile); at++; } }
/** * Constructs an instance. * * @param annotations {@code non-null;} set of annotations */ public AnnotationSetItem(Annotations annotations) { super(ALIGNMENT, writeSize(annotations)); this.annotations = annotations; this.items = new AnnotationItem[annotations.size()]; int at = 0; for (Annotation a : annotations.getAnnotations()) { items[at] = new AnnotationItem(a); at++; } }
/** * Constructs an instance. * * @param annotations {@code non-null;} set of annotations */ public AnnotationSetItem(Annotations annotations) { super(ALIGNMENT, writeSize(annotations)); this.annotations = annotations; this.items = new AnnotationItem[annotations.size()]; int at = 0; for (Annotation a : annotations.getAnnotations()) { items[at] = new AnnotationItem(a); at++; } }
/** * Constructs an instance. * * @param annotations {@code non-null;} set of annotations * @param dexFile {@code non-null;} dex output */ public AnnotationSetItem(Annotations annotations, DexFile dexFile) { super(ALIGNMENT, writeSize(annotations)); this.annotations = annotations; this.items = new AnnotationItem[annotations.size()]; int at = 0; for (Annotation a : annotations.getAnnotations()) { items[at] = new AnnotationItem(a, dexFile); at++; } }
/** * Constructs an instance. * * @param annotations {@code non-null;} set of annotations * @param dexFile {@code non-null;} dex output */ public AnnotationSetItem(Annotations annotations, DexFile dexFile) { super(ALIGNMENT, writeSize(annotations)); this.annotations = annotations; this.items = new AnnotationItem[annotations.size()]; int at = 0; for (Annotation a : annotations.getAnnotations()) { items[at] = new AnnotationItem(a, dexFile); at++; } }
/** * Inspects a class annotation. * * @param cf {@code non-null;} class file * @param ann {@code non-null;} annotation */ private void visitClassAnnotation(DirectClassFile cf, BaseAnnotations ann) { if (!args.eTypes.contains(ElementType.TYPE)) { return; } for (Annotation anAnn : ann.getAnnotations().getAnnotations()) { String annClassName = anAnn.getType().getClassType().getClassName(); if (args.aclass.equals(annClassName)) { printMatch(cf); } } }
/** * Inspects a class annotation. * * @param cf {@code non-null;} class file * @param ann {@code non-null;} annotation */ private void visitClassAnnotation(DirectClassFile cf, BaseAnnotations ann) { if (!args.eTypes.contains(ElementType.TYPE)) { return; } for (Annotation anAnn : ann.getAnnotations().getAnnotations()) { String annClassName = anAnn.getType().getClassType().getClassName(); if (args.aclass.equals(annClassName)) { printMatch(cf); } } }
/** * Inspects a class annotation. * * @param cf {@code non-null;} class file * @param ann {@code non-null;} annotation */ private void visitClassAnnotation(DirectClassFile cf, BaseAnnotations ann) { if (!args.eTypes.contains(ElementType.TYPE)) { return; } for (Annotation anAnn : ann.getAnnotations().getAnnotations()) { String annClassName = anAnn.getType().getClassType().getClassName(); if (args.aclass.equals(annClassName)) { printMatch(cf); } } }
/** * Inspects a class annotation. * * @param cf {@code non-null;} class file * @param ann {@code non-null;} annotation */ private void visitClassAnnotation(DirectClassFile cf, BaseAnnotations ann) { if (!args.eTypes.contains(ElementType.TYPE)) { return; } for (Annotation anAnn : ann.getAnnotations().getAnnotations()) { String annClassName = anAnn.getType().getClassType().getClassName(); if (args.aclass.equals(annClassName)) { printMatch(cf); } } }
/** * Inspects a class annotation. * * @param cf {@code non-null;} class file * @param ann {@code non-null;} annotation */ private void visitClassAnnotation(DirectClassFile cf, BaseAnnotations ann) { if (!args.eTypes.contains(ElementType.TYPE)) { return; } for (Annotation anAnn : ann.getAnnotations().getAnnotations()) { String annClassName = anAnn.getType().getClassType().getClassName(); if (args.aclass.equals(annClassName)) { printMatch(cf); } } }
for (Annotation a : methodAnnotations.getAnnotations()) { pw.println(" " + a); pw.println(" parameter " + i); Annotations annotations = parameterAnnotations.get(i); for (Annotation a : annotations.getAnnotations()) { pw.println(" " + a);
/** * Inspects a package annotation * * @param cf {@code non-null;} class file of "package-info" pseudo-class * @param ann {@code non-null;} annotation */ private void visitPackageAnnotation( DirectClassFile cf, BaseAnnotations ann) { if (!args.eTypes.contains(ElementType.PACKAGE)) { return; } String packageName = cf.getThisClass().getClassType().getClassName(); int slashIndex = packageName.lastIndexOf('/'); if (slashIndex == -1) { packageName = ""; } else { packageName = packageName.substring(0, slashIndex); } for (Annotation anAnn : ann.getAnnotations().getAnnotations()) { String annClassName = anAnn.getType().getClassType().getClassName(); if (args.aclass.equals(annClassName)) { printMatchPackage(packageName); } } }
/** * Inspects a package annotation * * @param cf {@code non-null;} class file of "package-info" pseudo-class * @param ann {@code non-null;} annotation */ private void visitPackageAnnotation( DirectClassFile cf, BaseAnnotations ann) { if (!args.eTypes.contains(ElementType.PACKAGE)) { return; } String packageName = cf.getThisClass().getClassType().getClassName(); int slashIndex = packageName.lastIndexOf('/'); if (slashIndex == -1) { packageName = ""; } else { packageName = packageName.substring(0, slashIndex); } for (Annotation anAnn : ann.getAnnotations().getAnnotations()) { String annClassName = anAnn.getType().getClassType().getClassName(); if (args.aclass.equals(annClassName)) { printMatchPackage(packageName); } } }
/** * Inspects a package annotation * * @param cf {@code non-null;} class file of "package-info" pseudo-class * @param ann {@code non-null;} annotation */ private void visitPackageAnnotation( DirectClassFile cf, BaseAnnotations ann) { if (!args.eTypes.contains(ElementType.PACKAGE)) { return; } String packageName = cf.getThisClass().getClassType().getClassName(); int slashIndex = packageName.lastIndexOf('/'); if (slashIndex == -1) { packageName = ""; } else { packageName = packageName.substring(0, slashIndex); } for (Annotation anAnn : ann.getAnnotations().getAnnotations()) { String annClassName = anAnn.getType().getClassType().getClassName(); if (args.aclass.equals(annClassName)) { printMatchPackage(packageName); } } }
/** * Inspects a package annotation * * @param cf {@code non-null;} class file of "package-info" pseudo-class * @param ann {@code non-null;} annotation */ private void visitPackageAnnotation( DirectClassFile cf, BaseAnnotations ann) { if (!args.eTypes.contains(ElementType.PACKAGE)) { return; } String packageName = cf.getThisClass().getClassType().getClassName(); int slashIndex = packageName.lastIndexOf('/'); if (slashIndex == -1) { packageName = ""; } else { packageName = packageName.substring(0, slashIndex); } for (Annotation anAnn : ann.getAnnotations().getAnnotations()) { String annClassName = anAnn.getType().getClassType().getClassName(); if (args.aclass.equals(annClassName)) { printMatchPackage(packageName); } } }
/** * Inspects a package annotation * * @param cf {@code non-null;} class file of "package-info" pseudo-class * @param ann {@code non-null;} annotation */ private void visitPackageAnnotation( DirectClassFile cf, BaseAnnotations ann) { if (!args.eTypes.contains(ElementType.PACKAGE)) { return; } String packageName = cf.getThisClass().getClassType().getClassName(); int slashIndex = packageName.lastIndexOf('/'); if (slashIndex == -1) { packageName = ""; } else { packageName = packageName.substring(0, slashIndex); } for (Annotation anAnn : ann.getAnnotations().getAnnotations()) { String annClassName = anAnn.getType().getClassType().getClassName(); if (args.aclass.equals(annClassName)) { printMatchPackage(packageName); } } }
private static Annotation getAnnotation(AttributeList attrs, Class<?> annotationClazz) { BaseAnnotations a= (BaseAnnotations) attrs.findFirst(AttRuntimeInvisibleAnnotations.ATTRIBUTE_NAME); if (a != null) { String annotationName= getClassWithSlashes(annotationClazz); for (Annotation an : a.getAnnotations().getAnnotations()) { if (an.getType().getClassType().getClassName().equals(annotationName)) { return an; } } } return null; }