ImmutableAnnotation ann = new ImmutableAnnotation(AnnotationVisibility.RUNTIME, "Ljava/lang/Deprecated;", Collections.<AnnotationElement>emptySet()); annotations.add(ann); = new ImmutableAnnotation(AnnotationVisibility.SYSTEM, "Ldalvik/annotation/Signature;", elements); annotations.add(ann); skipList.add("Ldalvik/annotation/Signature;");
public ImmutableMethodParameter(@Nonnull String type, @Nullable Set<? extends Annotation> annotations, @Nullable String name) { this.type = type; this.annotations = ImmutableAnnotation.immutableSetOf(annotations); this.name = name; }
@Nonnull @Override protected ImmutableAnnotation makeImmutable(@Nonnull Annotation item) { return ImmutableAnnotation.of(item); } };
public ImmutableMethodParameter(@Nonnull String type, @Nullable Set<? extends Annotation> annotations, @Nullable String name) { this.type = type; this.annotations = ImmutableAnnotation.immutableSetOf(annotations); this.name = name; }
@Nonnull @Override protected ImmutableAnnotation makeImmutable(@Nonnull Annotation item) { return ImmutableAnnotation.of(item); } };
private Set<Annotation> buildMethodAnnotations(SootMethod m) { Set<String> skipList = new HashSet<String>(); Set<Annotation> annotations = buildCommonAnnotations(m, skipList); for (Tag t : m.getTags()) { if (t.getName().equals("VisibilityAnnotationTag")) { List<ImmutableAnnotation> visibilityItems = buildVisibilityAnnotationTag((VisibilityAnnotationTag) t, skipList); annotations.addAll(visibilityItems); } } List<SootClass> exceptionList = m.getExceptionsUnsafe(); if (exceptionList != null && !exceptionList.isEmpty()) { List<ImmutableEncodedValue> valueList = new ArrayList<ImmutableEncodedValue>(exceptionList.size()); for (SootClass exceptionClass : exceptionList) { valueList.add(new ImmutableTypeEncodedValue(DexType.toDalvikICAT(exceptionClass.getName()).replace(".", "/"))); } ImmutableArrayEncodedValue valueValue = new ImmutableArrayEncodedValue(valueList); ImmutableAnnotationElement valueElement = new ImmutableAnnotationElement("value", valueValue); Set<ImmutableAnnotationElement> elements = Collections.singleton(valueElement); ImmutableAnnotation ann = new ImmutableAnnotation(AnnotationVisibility.SYSTEM, "Ldalvik/annotation/Throws;", elements); annotations.add(ann); } return annotations; }
public ImmutableMethodParameter(@Nonnull String type, @Nullable Set<? extends Annotation> annotations, @Nullable String name) { this.type = type; this.annotations = ImmutableAnnotation.immutableSetOf(annotations); this.name = name; }
@Nonnull @Override protected ImmutableAnnotation makeImmutable(@Nonnull Annotation item) { return ImmutableAnnotation.of(item); } };
private Annotation buildEnclosingMethodTag(EnclosingMethodTag t, Set<String> skipList) { if (!skipList.add("Ldalvik/annotation/EnclosingMethod;")) { return null; } if (t.getEnclosingMethod() == null) { return null; } String[] split1 = t.getEnclosingMethodSig().split("\\)"); String parametersS = split1[0].replaceAll("\\(", ""); String returnTypeS = split1[1]; List<String> typeList = new ArrayList<String>(); if (!parametersS.equals("")) { for (String p : Util.splitParameters(parametersS)) { if (!p.isEmpty()) { typeList.add(p); } } } ImmutableMethodReference mRef = new ImmutableMethodReference(SootToDexUtils.getDexClassName(t.getEnclosingClass()), t.getEnclosingMethod(), typeList, returnTypeS); ImmutableMethodEncodedValue methodRef = new ImmutableMethodEncodedValue(mRef); AnnotationElement methodElement = new ImmutableAnnotationElement("value", methodRef); return new ImmutableAnnotation(AnnotationVisibility.SYSTEM, "Ldalvik/annotation/EnclosingMethod;", Collections.singleton(methodElement)); }
public ImmutableField(@Nonnull String definingClass, @Nonnull String name, @Nonnull String type, int accessFlags, @Nullable EncodedValue initialValue, @Nullable Collection<? extends Annotation> annotations) { this.definingClass = definingClass; this.name = name; this.type = type; this.accessFlags = accessFlags; this.initialValue = ImmutableEncodedValueFactory.ofNullable(initialValue); this.annotations = ImmutableAnnotation.immutableSetOf(annotations); }
ImmutableAnnotation memberAnnotation = new ImmutableAnnotation(AnnotationVisibility.SYSTEM, "Ldalvik/annotation/MemberClasses;", Collections.singletonList(element)); if (anns == null) {
public ImmutableField(@Nonnull String definingClass, @Nonnull String name, @Nonnull String type, int accessFlags, @Nullable EncodedValue initialValue, @Nullable Collection<? extends Annotation> annotations) { this.definingClass = definingClass; this.name = name; this.type = type; this.accessFlags = accessFlags; this.initialValue = ImmutableEncodedValueFactory.ofNullable(initialValue); this.annotations = ImmutableAnnotation.immutableSetOf(annotations); }
ImmutableAnnotation ann = new ImmutableAnnotation(getVisibility(t.getVisibility()), typeName, elements); annotations.add(ann);
public ImmutableField(@Nonnull String definingClass, @Nonnull String name, @Nonnull String type, int accessFlags, @Nullable EncodedValue initialValue, @Nullable Collection<? extends Annotation> annotations) { this.definingClass = definingClass; this.name = name; this.type = type; this.accessFlags = accessFlags; this.initialValue = ImmutableEncodedValueFactory.ofNullable(initialValue); this.annotations = ImmutableAnnotation.immutableSetOf(annotations); }
ImmutableAnnotation ann = new ImmutableAnnotation(getVisibility(vat.getVisibility()), SootToDexUtils.getDexClassName(at.getType()), elements); annotations.add(ann);
public ImmutableMethod(@Nonnull String definingClass, @Nonnull String name, @Nullable Iterable<? extends MethodParameter> parameters, @Nonnull String returnType, int accessFlags, @Nullable Set<? extends Annotation> annotations, @Nullable MethodImplementation methodImplementation) { this.definingClass = definingClass; this.name = name; this.parameters = ImmutableMethodParameter.immutableListOf(parameters); this.returnType = returnType; this.accessFlags = accessFlags; this.annotations = ImmutableAnnotation.immutableSetOf(annotations); this.methodImplementation = ImmutableMethodImplementation.of(methodImplementation); }
anns = new ArrayList<Annotation>(); anns.add(new ImmutableAnnotation(AnnotationVisibility.SYSTEM, "Ldalvik/annotation/InnerClass;", elements));
public ImmutableMethod(@Nonnull String definingClass, @Nonnull String name, @Nullable Iterable<? extends MethodParameter> parameters, @Nonnull String returnType, int accessFlags, @Nullable Set<? extends Annotation> annotations, @Nullable MethodImplementation methodImplementation) { this.definingClass = definingClass; this.name = name; this.parameters = ImmutableMethodParameter.immutableListOf(parameters); this.returnType = returnType; this.accessFlags = accessFlags; this.annotations = ImmutableAnnotation.immutableSetOf(annotations); this.methodImplementation = ImmutableMethodImplementation.of(methodImplementation); }
annotations.add(new ImmutableAnnotation(AnnotationVisibility.SYSTEM, "Ldalvik/annotation/EnclosingClass;", Collections.singleton(enclosingElement)));
public ImmutableMethod(@Nonnull String definingClass, @Nonnull String name, @Nullable Iterable<? extends MethodParameter> parameters, @Nonnull String returnType, int accessFlags, @Nullable Set<? extends Annotation> annotations, @Nullable MethodImplementation methodImplementation) { this.definingClass = definingClass; this.name = name; this.parameters = ImmutableMethodParameter.immutableListOf(parameters); this.returnType = returnType; this.accessFlags = accessFlags; this.annotations = ImmutableAnnotation.immutableSetOf(annotations); this.methodImplementation = ImmutableMethodImplementation.of(methodImplementation); }