elem = new AnnotationIntElem(v.getValue(), 'B', ae.getName()); break; elem = new AnnotationIntElem(v.getValue(), 'S', ae.getName()); break; elem = new AnnotationIntElem(v.getValue(), 'C', ae.getName()); break; elem = new AnnotationIntElem(v.getValue(), 'I', ae.getName()); break; elem = new AnnotationLongElem(v.getValue(), 'J', ae.getName()); break; elem = new AnnotationFloatElem(v.getValue(), 'F', ae.getName()); break; elem = new AnnotationDoubleElem(v.getValue(), 'D', ae.getName()); break; elem = new AnnotationStringElem(v.getValue(), 's', ae.getName()); break; elem = new AnnotationClassElem(v.getValue(), 'c', ae.getName()); break; fieldSig += DexType.toSootAT(fr.getType()) + " "; fieldSig += fr.getName();
private ArrayList<AnnotationElem> getElements(Set<? extends AnnotationElement> set) { ArrayList<AnnotationElem> aelemList = new ArrayList<AnnotationElem>(); for (AnnotationElement ae : set) { // Debug.printDbg("element: ", ae.getName() ," ", ae.getValue() ," // type: ", ae.getClass()); // Debug.printDbg("value type: ", ae.getValue().getValueType() ," // class: ", ae.getValue().getClass()); List<AnnotationElem> eList = handleAnnotationElement(ae, Collections.singletonList(ae.getValue())); if (eList != null) { aelemList.addAll(eList); } } return aelemList; }
@Nonnull @Override public String getName() { return annotationElement.getName(); }
private String buildASMSignature(ClassDef classDef) { String signature = null; outer: for (Annotation annotation : classDef.getAnnotations()) { if (!annotation.getType().equals("Ldalvik/annotation/Signature;")) { continue; } StringBuilder sb = new StringBuilder(); for (AnnotationElement e : annotation.getElements()) { BuilderEncodedValues.BuilderArrayEncodedValue ev = (BuilderEncodedValues.BuilderArrayEncodedValue) e .getValue(); for (EncodedValue v : ev.getValue()) { BuilderEncodedValues.BuilderStringEncodedValue value = (BuilderEncodedValues.BuilderStringEncodedValue) v; sb.append(value.getValue()); } } signature = sb.toString(); break; } return signature; }
public static ImmutableAnnotationElement of(AnnotationElement annotationElement) { if (annotationElement instanceof ImmutableAnnotationElement) { return (ImmutableAnnotationElement)annotationElement; } return new ImmutableAnnotationElement( annotationElement.getName(), annotationElement.getValue()); }
private void visitClassAnnotations(Set<? extends Annotation> annotations, ClassWriter classWriter) { for (Annotation annotation : annotations) { switch (annotation.getType()) { case "Ldalvik/annotation/EnclosingMethod;": for (AnnotationElement e : annotation.getElements()) { BuilderEncodedValues.BuilderMethodEncodedValue v = (BuilderEncodedValues.BuilderMethodEncodedValue) e .getValue(); visitEnclosingMethod(v, classWriter); // There should only ever be one enclosing method. break; } break; case "Ldalvik/annotation/MemberClasses;": for (AnnotationElement e : annotation.getElements()) { BuilderEncodedValues.BuilderArrayEncodedValue ev = (BuilderEncodedValues.BuilderArrayEncodedValue) e .getValue(); for (EncodedValue v : ev.getValue()) { BuilderEncodedValues.BuilderTypeEncodedValue value = (BuilderEncodedValues.BuilderTypeEncodedValue) v; visitInnerClasses(value, classWriter); } } break; } } }
@Nonnull @Override public String getName() { return annotationElement.getName(); }
public static ImmutableAnnotationElement of(AnnotationElement annotationElement) { if (annotationElement instanceof ImmutableAnnotationElement) { return (ImmutableAnnotationElement)annotationElement; } return new ImmutableAnnotationElement( annotationElement.getName(), annotationElement.getValue()); }
protected List<SootClass> getThrownExceptions(final Method method) { // the following snippet retrieves all exceptions that this method // throws by analyzing its annotations List<SootClass> thrownExceptions = new ArrayList<SootClass>(); for (Annotation a : method.getAnnotations()) { Type atype = DexType.toSoot(a.getType()); String atypes = atype.toString(); if (!(atypes.equals("dalvik.annotation.Throws"))) { continue; } for (AnnotationElement ae : a.getElements()) { EncodedValue ev = ae.getValue(); if (ev instanceof ArrayEncodedValue) { for (EncodedValue evSub : ((ArrayEncodedValue) ev).getValue()) { if (evSub instanceof TypeEncodedValue) { TypeEncodedValue valueType = (TypeEncodedValue) evSub; String exceptionName = valueType.getValue(); String dottedName = Util.dottedClassName(exceptionName); thrownExceptions.add(SootResolver.v().makeClassRef(dottedName)); } } } } } return thrownExceptions; } }
@Nonnull @Override public String getName() { return annotationElement.getName(); }
public static ImmutableAnnotationElement of(AnnotationElement annotationElement) { if (annotationElement instanceof ImmutableAnnotationElement) { return (ImmutableAnnotationElement)annotationElement; } return new ImmutableAnnotationElement( annotationElement.getName(), annotationElement.getValue()); }
String outerClass = ((TypeEncodedValue) elem.getValue()).getValue(); outerClass = Util.dottedClassName(outerClass);
@Nonnull @Override public EncodedValue getElementValue(@Nonnull AnnotationElement annotationElement) { return annotationElement.getValue(); } }
@Nonnull @Override public EncodedValue getElementValue(@Nonnull AnnotationElement annotationElement) { return annotationElement.getValue(); } }
@Nonnull @Override public CharSequence getElementName(@Nonnull AnnotationElement annotationElement) { return annotationElement.getName(); }