I am iterating over one class using ASM code without manipulating any byte code. But when I am converting classwriter to bytearray(cw.toByteArray()), I am getting Method code too large! exception.
Can anybody tell me when does this happen ..
My code snippet is as follows ---
InputStream in= new FileInputStream("D:/AshiqWorkspace/RandD/ByteCodeStudy/temp/GameManager.class"); ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_MAXS|ClassWriter.COMPUTE_FRAMES); ClassVisitor ca = null; ca = new CustomClassNode(cw); // CustomClassNode class extends ClassNode implements Opcodes cr.accept(ca, 0); File outputDir=new File("D:/AshiqWorkspace/RandD/ByteCodeStudy/out"); outputDir.mkdirs(); DataOutputStream dout=new DataOutputStream(new FileOutputStream(new File(outputDir,"GameManager.class"))); dout.write(cw.toByteArray()); // on this line "method code too large exception coming"