@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); } };
/** * @ast method * @aspect AnnotationsCodegen * @declaredat /Users/eric/Documents/workspaces/clara-soot/JastAddExtensions/Jimple1.5Backend/AnnotationsCodegen.jrag:125 */ public void addRuntimeInvisibleAnnotationsAttribute(Collection c) { Collection annotations = runtimeInvisibleAnnotations(); if(!annotations.isEmpty()) { soot.tagkit.VisibilityAnnotationTag tag = new soot.tagkit.VisibilityAnnotationTag(soot.tagkit.AnnotationConstants.RUNTIME_INVISIBLE); for(Iterator iter = annotations.iterator(); iter.hasNext(); ) { Annotation annotation = (Annotation)iter.next(); ArrayList elements = new ArrayList(1); annotation.appendAsAttributeTo(elements); tag.addAnnotation((soot.tagkit.AnnotationTag)elements.get(0)); } c.add(tag); } } /**
/** * @ast method * @aspect AnnotationsCodegen * @declaredat /Users/eric/Documents/workspaces/clara-soot/JastAddExtensions/Jimple1.5Backend/AnnotationsCodegen.jrag:110 */ public void addRuntimeVisibleAnnotationsAttribute(Collection c) { Collection annotations = runtimeVisibleAnnotations(); if(!annotations.isEmpty()) { soot.tagkit.VisibilityAnnotationTag tag = new soot.tagkit.VisibilityAnnotationTag(soot.tagkit.AnnotationConstants.RUNTIME_VISIBLE); for(Iterator iter = annotations.iterator(); iter.hasNext(); ) { Annotation annotation = (Annotation)iter.next(); ArrayList elements = new ArrayList(1); annotation.appendAsAttributeTo(elements); tag.addAnnotation((soot.tagkit.AnnotationTag)elements.get(0)); } c.add(tag); } } /**
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); }
ArrayList elements = new ArrayList(1); annotation.appendAsAttributeTo(elements); tag.addAnnotation((soot.tagkit.AnnotationTag) elements.get(0));
ArrayList elements = new ArrayList(1); annotation.appendAsAttributeTo(elements); tag.addAnnotation((soot.tagkit.AnnotationTag) elements.get(0));
ArrayList elements = new ArrayList(1); annotation.appendAsAttributeTo(elements); tag.addAnnotation((soot.tagkit.AnnotationTag) elements.get(0));
ArrayList elements = new ArrayList(1); annotation.appendAsAttributeTo(elements); tag.addAnnotation((soot.tagkit.AnnotationTag) elements.get(0));
/** * @ast method * @aspect AnnotationsCodegen * @declaredat /Users/eric/Documents/workspaces/clara-soot/JastAddExtensions/Jimple1.5Backend/AnnotationsCodegen.jrag:83 */ public void addSourceOnlyAnnotations(Collection c) { if(new soot.options.JBOptions(soot.PhaseOptions.v().getPhaseOptions("jb")). preserve_source_annotations()) { for(int i = 0; i < getNumModifier(); i++) { if(getModifier(i) instanceof Annotation) { Annotation a = (Annotation)getModifier(i); if(!a.isRuntimeVisible() && !a.isRuntimeInvisible()) { soot.tagkit.VisibilityAnnotationTag tag = new soot.tagkit.VisibilityAnnotationTag(soot.tagkit.AnnotationConstants.SOURCE_VISIBLE); ArrayList elements = new ArrayList(1); a.appendAsAttributeTo(elements); tag.addAnnotation((soot.tagkit.AnnotationTag)elements.get(0)); c.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); }
vatg[v] = new VisibilityAnnotationTag(v); vatg[v].addAnnotation(adt); break; case DALVIK_ANNOTATION_ENCLOSINGCLASS: vatg[v] = new VisibilityAnnotationTag(v); vatg[v].addAnnotation(deprecated); break; default:
paramVat.addAnnotation(vat);
VisibilityAnnotationTag defaultAnnotationTag = new VisibilityAnnotationTag(AnnotationConstants.RUNTIME_INVISIBLE); AnnotationTag a = new AnnotationTag("Ldalvik/annotation/AnnotationDefault;"); defaultAnnotationTag.addAnnotation(a);
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); } }