use of com.googlecode.d2j.dex.writer.DexFileWriter in project dex2jar by pxb1988.
the class AppWriterTest method test3.
@Test
public void test3() {
DexFileWriter w = new DexFileWriter();
DexClassVisitor cv = w.visit(0x1, "La/c;", null, new String[] { "Ljava/lang/Comparable;" });
cv.visitSource("c.java");
cv.visitAnnotation("LAnn;", Visibility.SYSTEM).visitEnd();
DexFieldVisitor fv = cv.visitField(ACC_PUBLIC | ACC_STATIC, new Field("La/c;", "a", "I"), 55);
fv.visitAnnotation("LE;", Visibility.RUNTIME).visitEnd();
fv.visitEnd();
DexMethodVisitor mv = cv.visitMethod(ACC_STATIC, new Method("La/c;", "bb", new String[] { "I" }, "V"));
mv.visitAnnotation("Laaa;", Visibility.RUNTIME).visitEnd();
DexAnnotationVisitor dav = mv.visitParameterAnnotation(0).visitAnnotation("Laaa;", Visibility.RUNTIME);
dav.visit("abc", true);
DexAnnotationVisitor dav2 = dav.visitArray("efg");
dav2.visit("", "123");
dav2.visit("", "456");
dav2.visitEnd();
dav.visitEnd();
DexCodeVisitor code = mv.visitCode();
code.visitRegister(2);
code.visitStmt0R(Op.RETURN_VOID);
code.visitEnd();
mv.visitEnd();
cv.visitEnd();
w.visitEnd();
w.toByteArray();
}
Aggregations