return cw.toByteArray();
}
public byte[] dumpAnnotated() {
ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_MAXS);
FieldVisitor fv;
MethodVisitor mv;
AnnotationVisitor av0, av1;
cw.visit(V1_5,
ACC_PUBLIC + ACC_SUPER,
"pkg/Annotated",
null,
"java/lang/Object",
null);
// visible class annotation
cw.visitAnnotation(DEPRECATED, true).visitEnd();
// invisible class annotation, with values of all types
av0 = cw.visitAnnotation("Lpkg/Annotation;", false);
av0.visit("byteValue", new Byte((byte) 0));
av0.visit("charValue", new Character((char) 48));
av0.visit("booleanValue", Boolean.FALSE);
av0.visit("intValue", new Integer(0));
av0.visit("shortValue", new Short((short) 0));
av0.visit("longValue", new Long(0L));
av0.visit("floatValue", new Float("0.0"));
av0.visit("doubleValue", new Double("0.0"));
av0.visit("stringValue", "0");
av0.visitEnum("enumValue", "Lpkg/Enum;", "V0");
av0.visitAnnotation("annotationValue", DOC).visitEnd();
av0.visit("classValue", Type.getType("Lpkg/Annotation;"));
av0.visit("byteArrayValue", new byte[] { 1, 0 });
av0.visit("charArrayValue", new char[] { '1', '0' });
av0.visit("booleanArrayValue", new boolean[] { true, false });
av0.visit("intArrayValue", new int[] { 1, 0 });
av0.visit("shortArrayValue", new short[] { (short) 1, (short) 0 });
av0.visit("longArrayValue", new long[] { 1L, 0L });
av0.visit("floatArrayValue", new float[] { 1.0f, 0.0f });
av0.visit("doubleArrayValue", new double[] { 1.0d, 0.0d });
av1 = av0.visitArray("stringArrayValue");
av1.visit(null, "1");
av1.visit(null, "0");
av1.visitEnd();
av0.visitArray("classArrayValue").visitEnd();
av1 = av0.visitArray("enumArrayValue");
av1.visitEnum(null, "Lpkg/Enum;", "V1");
av1.visitEnum(null, "Lpkg/Enum;", "V2");
av1.visitEnd();
av0.visitArray("annotationArrayValue").visitEnd();
av0.visitEnd();
fv = cw.visitField(ACC_PUBLIC, "f", "I", null, null);
// visible field annotation
fv.visitAnnotation(DEPRECATED, true).visitEnd();
// invisible field annotation
av0 = fv.visitAnnotation("Lpkg/Annotation;", false);
av0.visitEnum("enumValue", "Lpkg/Enum;", "V0");
av0.visitEnd();
fv.visitEnd();
mv = cw.visitMethod(ACC_PUBLIC, "<init>", "(IIIIIIIIII)V", null, null);
// visible method annotation
mv.visitAnnotation(DEPRECATED, true).visitEnd();
// invisible method annotation