@Override public void visitEnd() { AnnotationTag tag = new AnnotationTag(desc, elems); AnnotationElemBuilder.this.elems.add(new AnnotationAnnotationElem(tag, '@', name)); } };
@Override public void visitEnd() { AnnotationTag annotTag = new AnnotationTag(desc, elems); _vat.addAnnotation(annotTag); } };
@Override public void visitEnd() { AnnotationTag annotTag = new AnnotationTag(desc, elems); _tag.addAnnotation(annotTag); } };
private void addAnnotations(int numAnnots, annotation[] annotations, ClassFile coffiClass, VisibilityAnnotationTag tag, Collection<Type> references) { for (int i = 0; i < numAnnots; i++) { annotation annot = annotations[i]; String annotType = ((CONSTANT_Utf8_info) coffiClass.constant_pool[annot.type_index]).convert(); String ref = annotType.substring(1, annotType.length() - 1); ref = ref.replace('/', '.'); references.add(RefType.v(ref)); AnnotationTag annotTag = new AnnotationTag(annotType, createElementTags(annot.num_element_value_pairs, coffiClass, annot.element_value_pairs)); tag.addAnnotation(annotTag); } }
/** * Applies a Java 1.5-style annotation to a given Host. The Host must be of type {@link SootClass}, {@link SootMethod} or * {@link SootField}. * * @param h * a method, field, or class * @param annotationName * the qualified name of the annotation class * @param visibility * any of the constants in {@link AnnotationConstants} * @param elems * a (possibly empty) sequence of AnnotationElem objects corresponding to the elements that should be contained in * this annotation */ public void annotate(Host h, String annotationName, int visibility, List<AnnotationElem> elems) { annotationName = annotationName.replace('.', '/'); if (!annotationName.endsWith(";")) { annotationName = "L" + annotationName + ';'; } VisibilityAnnotationTag tagToAdd = findOrAdd(h, visibility); AnnotationTag at = new AnnotationTag(annotationName, elems); tagToAdd.addAnnotation(at); }
/** * @ast method * @aspect AnnotationsCodegen * @declaredat /Users/eric/Documents/workspaces/clara-soot/JastAddExtensions/Jimple1.5Backend/AnnotationsCodegen.jrag:305 */ public void appendAsAttributeTo(Collection list) { soot.tagkit.AnnotationTag tag = new soot.tagkit.AnnotationTag(decl().typeDescriptor(), getNumElementValuePair()); ArrayList elements = new ArrayList(getNumElementValuePair()); for(int i = 0; i < getNumElementValuePair(); i++) { String name = getElementValuePair(i).getName(); ElementValue value = getElementValuePair(i).getElementValue(); value.appendAsAttributeTo(elements, name); } tag.setElems(elements); list.add(tag); } /**
/** * Processes a normal annotation and adds it to the proper visibility annotation tag in the given array * * @param vatg * the visibility annotation tags for different visibility levels * @param a * the annotation * @param v * the visibility */ protected void addNormalAnnotation(VisibilityAnnotationTag[] vatg, Annotation a, int v) { if (vatg[v] == null) { vatg[v] = new VisibilityAnnotationTag(v); } AnnotationTag tag = new AnnotationTag(a.getType()); for (AnnotationElem e : getElements(a.getElements())) { tag.addElem(e); } vatg[v].addAnnotation(tag); }
annotation annot = aev.annotation_value; String annotType = ((CONSTANT_Utf8_info) coffiClass.constant_pool[annot.type_index]).convert(); AnnotationTag annotTag = new AnnotationTag(annotType, createElementTags(annot.num_element_value_pairs, coffiClass, annot.element_value_pairs));
if (!(t instanceof VisibilityAnnotationTag)) { if (t instanceof DeprecatedTag) { vat = new AnnotationTag("Ljava/lang/Deprecated;"); } else if (t instanceof SignatureTag) { SignatureTag sig = (SignatureTag) t; vat = new AnnotationTag("Ldalvik/annotation/Signature;", Collections.singleton(elem)); } else { throw new RuntimeException("error: unhandled tag for parameter annotation in method " + h + " (" + t + ").");
AnnotationTag a = new AnnotationTag("Ldalvik/annotation/AnnotationDefault;"); defaultAnnotationTag.addAnnotation(a); AnnotationTag at = new AnnotationTag(SootToDexUtils.getDexClassName(c.getName())); AnnotationAnnotationElem ae = new AnnotationAnnotationElem(at, '@', "value"); a.addElem(ae);
AnnotationTag adt = new AnnotationTag(a.getType()); adt.addElem(anne); if (vatg[v] == null) { AnnotationTag deprecated = new AnnotationTag("Ljava/lang/Deprecated;"); if (vatg[v] == null) { vatg[v] = new VisibilityAnnotationTag(v);
AnnotationTag t = new AnnotationTag(DexType.toSootAT(v.getType()).toString()); for (AnnotationElement newElem : v.getElements()) { List<EncodedValue> l = new ArrayList<EncodedValue>();
private void addAnnotations(int numAnnots, annotation [] annotations, ClassFile coffiClass, VisibilityAnnotationTag tag, List references){ for (int i = 0; i < numAnnots; i++){ annotation annot = annotations[i]; String annotType = ((CONSTANT_Utf8_info)coffiClass.constant_pool[annot.type_index]).convert(); String ref = annotType.substring(1, annotType.length()-1); ref = ref.replace('/', '.'); references.add(ref); int numElems = annot.num_element_value_pairs; AnnotationTag annotTag = new AnnotationTag(annotType, numElems); annotTag.setElems(createElementTags(numElems, coffiClass, annot.element_value_pairs)); tag.addAnnotation(annotTag); } }
private void addAnnotations(int numAnnots, annotation [] annotations, ClassFile coffiClass, VisibilityAnnotationTag tag, List references){ for (int i = 0; i < numAnnots; i++){ annotation annot = annotations[i]; String annotType = ((CONSTANT_Utf8_info)coffiClass.constant_pool[annot.type_index]).convert(); String ref = annotType.substring(1, annotType.length()-1); ref = ref.replace('/', '.'); references.add(ref); int numElems = annot.num_element_value_pairs; AnnotationTag annotTag = new AnnotationTag(annotType, numElems); annotTag.setElems(createElementTags(numElems, coffiClass, annot.element_value_pairs)); tag.addAnnotation(annotTag); } }
String annotType = ((CONSTANT_Utf8_info)coffiClass.constant_pool[annot.type_index]).convert(); int numElems = annot.num_element_value_pairs; AnnotationTag annotTag = new AnnotationTag(annotType, numElems); annotTag.setElems(createElementTags(numElems, coffiClass, annot.element_value_pairs));
String annotType = ((CONSTANT_Utf8_info)coffiClass.constant_pool[annot.type_index]).convert(); int numElems = annot.num_element_value_pairs; AnnotationTag annotTag = new AnnotationTag(annotType, numElems); annotTag.setElems(createElementTags(numElems, coffiClass, annot.element_value_pairs));