NPE in MethodWriter.resizeInstructions()
ASM Version: 5.0.1
While working on a reproducer for issue 317551 I came across the following NPE
while creating a large method:
Exception in thread "main" java.lang.NullPointerException
at org.objectweb.asm.MethodWriter.resizeInstructions(MethodWriter.java:2709)
at org.objectweb.asm.MethodWriter.visitMaxs(MethodWriter.java:1407)
at org.objectweb.asm.ClassReader.readCode(ClassReader.java:1554)
at org.objectweb.asm.ClassReader.readMethod(ClassReader.java:1017)
at org.objectweb.asm.ClassReader.accept(ClassReader.java:693)
at org.objectweb.asm.ClassReader.accept(ClassReader.java:506)
at org.objectweb.asm.ClassWriter.toByteArray(ClassWriter.java:995)
at LargeMethodNPE.main(LargeMethodNPE.java:18)
Please find the reproducer attached.
Maybe I made a mistake using the visitor APIs, but a smaller version of the
same class (less NOP instructions) can be built and also loads into the JVM.