public void test() throws Exception { Attribute[] attributes = new Attribute[] { new ASMStackMapTableAttribute() }; ClassWriter cw = new ClassWriter(false); ClassReader cr1 = new ClassReader(is); cr1.accept(cw, attributes, true); ClassReader cr2 = new ClassReader(cw.toByteArray()); if (!Arrays.equals(cr1.b, cr2.b)) { StringWriter sw1 = new StringWriter(); StringWriter sw2 = new StringWriter(); ClassVisitor cv1 = new TraceClassVisitor(new PrintWriter(sw1)); ClassVisitor cv2 = new TraceClassVisitor(new PrintWriter(sw2)); cr1.accept(cv1, attributes, true); cr2.accept(cv2, attributes, true); assertEquals("different data", sw1.toString(), sw2.toString()); } }
/** * Returns the default {@link ASMifiable} prototypes. * * @return the default {@link ASMifiable} prototypes. */ public static Attribute[] getDefaultAttributes() { try { return new Attribute[] { new ASMStackMapAttribute(), new ASMStackMapTableAttribute() }; } catch (Exception e) { return new Attribute[0]; } }