ASM incorrectly expands frames in some cases.
When instrumenting classes from JBoss Weld, expanding frames can cause ASM to throw an exception upon reprocessing it's own class files. Here is a simple reproduction for a sample class file (attached):
ClassReader classReader = new ClassReader(new FileInputStream("sample.class"));
ClassWriter classWriter = new ClassWriter(ClassWriter.COMPUTE_FRAMES);
CheckClassAdapter classVisitor = new CheckClassAdapter(classWriter, true);
classReader.accept(new TraceClassVisitor(classVisitor, new PrintWriter(System.out)), ClassReader.EXPAND_FRAMES);
When removing the EXPAND_FRAMES
option, the class file can be reprocessed without issues.