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; }
classDef.getInterfaces(), classDef.getSourceFile(), classDef.getAnnotations(), builderFields, builderMethods
Set<? extends Annotation> aSet = classDef.getAnnotations(); if (aSet == null || aSet.isEmpty()) { return;
private void visitClass(ClassDef classDef, ClassWriter classWriter) { int version = Opcodes.V1_8; int access = classDef.getAccessFlags(); String name = stripName(classDef.getType()); // Signature should be type signature for the class, which is uncommon. String signature = buildASMSignature(classDef); String superName = null; if (classDef.getSuperclass() != null) { superName = stripName(classDef.getSuperclass()); } String[] interfaces = buildInterfaces(classDef); classWriter.visit(version, access, name, signature, superName, interfaces); classWriter.visitSource(classDef.getSourceFile(), null); visitClassAnnotations(classDef.getAnnotations(), classWriter); }
@Nonnull @Override public Set<? extends Annotation> getAnnotations() { return classDef.getAnnotations(); }
@Nonnull @Override public Set<? extends Annotation> getAnnotations() { return classDef.getAnnotations(); }
@Nonnull @Override public Set<? extends Annotation> getAnnotations() { return classDef.getAnnotations(); }
@Override @Nonnull public Set<? extends Annotation> getAnnotations() { return RewriterUtils.rewriteSet(rewriters.getAnnotationRewriter(), classDef.getAnnotations()); }
@Override @Nonnull public Set<? extends Annotation> getAnnotations() { return RewriterUtils.rewriteSet(rewriters.getAnnotationRewriter(), classDef.getAnnotations()); }
@Override @Nonnull public Set<? extends Annotation> getAnnotations() { return RewriterUtils.rewriteSet(rewriters.getAnnotationRewriter(), classDef.getAnnotations()); }
private void writeAnnotations(IndentingWriter writer) throws IOException { Collection<? extends Annotation> classAnnotations = classDef.getAnnotations(); if (classAnnotations.size() != 0) { writer.write("\n\n"); writer.write("# annotations\n"); AnnotationFormatter.writeTo(writer, classAnnotations); } }
private void writeAnnotations(IndentingWriter writer) throws IOException { Collection<? extends Annotation> classAnnotations = classDef.getAnnotations(); if (classAnnotations.size() != 0) { writer.write("\n\n"); writer.write("# annotations\n"); String containingClass = null; if (options.implicitReferences) { containingClass = classDef.getType(); } AnnotationFormatter.writeTo(writer, classAnnotations, containingClass); } }
private void writeAnnotations(IndentingWriter writer) throws IOException { Collection<? extends Annotation> classAnnotations = classDef.getAnnotations(); if (classAnnotations.size() != 0) { writer.write("\n\n"); writer.write("# annotations\n"); String containingClass = null; if (options.implicitReferences) { containingClass = classDef.getType(); } AnnotationFormatter.writeTo(writer, classAnnotations, containingClass); } }
private void writeAnnotations(IndentingWriter writer) throws IOException { Collection<? extends Annotation> classAnnotations = classDef.getAnnotations(); if (classAnnotations.size() != 0) { writer.write("\n\n"); writer.write("# annotations\n"); String containingClass = null; if (options.useImplicitReferences) { containingClass = classDef.getType(); } AnnotationFormatter.writeTo(writer, classAnnotations, containingClass); } }
Collection<Annotation> getAnnotations(Set<String> types) { Set<Annotation> result = HashSetFactory.make(); for(org.jf.dexlib2.iface.Annotation a : classDef.getAnnotations()) { if (types == null || types.contains(AnnotationVisibility.getVisibility(a.getVisibility()))) { result.add(DexUtil.getAnnotation(a, getClassLoader().getReference())); } } return result; }
Collection<Annotation> getAnnotations(Set<String> types) { Set<Annotation> result = HashSetFactory.make(); for(org.jf.dexlib2.iface.Annotation a : classDef.getAnnotations()) { if (types == null || types.contains(AnnotationVisibility.getVisibility(a.getVisibility()))) { result.add(DexUtil.getAnnotation(a, getClassLoader().getReference())); } } return result; }
private static ClassDef reDexClass(@Nonnull ClassDef classDef) { return new ImmutableClassDef(classDef.getType(), classDef.getAccessFlags(), classDef.getSuperclass(), classDef.getInterfaces(), classDef.getSourceFile(), classDef.getAnnotations(), classDef.getFields(), reDexMethods(classDef)); }
public static ImmutableClassDef of(ClassDef classDef) { if (classDef instanceof ImmutableClassDef) { return (ImmutableClassDef)classDef; } return new ImmutableClassDef( classDef.getType(), classDef.getAccessFlags(), classDef.getSuperclass(), classDef.getInterfaces(), classDef.getSourceFile(), classDef.getAnnotations(), classDef.getStaticFields(), classDef.getInstanceFields(), classDef.getDirectMethods(), classDef.getVirtualMethods()); }
public static ImmutableClassDef of(ClassDef classDef) { if (classDef instanceof ImmutableClassDef) { return (ImmutableClassDef)classDef; } return new ImmutableClassDef( classDef.getType(), classDef.getAccessFlags(), classDef.getSuperclass(), classDef.getInterfaces(), classDef.getSourceFile(), classDef.getAnnotations(), classDef.getStaticFields(), classDef.getInstanceFields(), classDef.getDirectMethods(), classDef.getVirtualMethods()); }
public static ImmutableClassDef of(ClassDef classDef) { if (classDef instanceof ImmutableClassDef) { return (ImmutableClassDef)classDef; } return new ImmutableClassDef( classDef.getType(), classDef.getAccessFlags(), classDef.getSuperclass(), classDef.getInterfaces(), classDef.getSourceFile(), classDef.getAnnotations(), classDef.getStaticFields(), classDef.getInstanceFields(), classDef.getDirectMethods(), classDef.getVirtualMethods()); }