ClassWriter COMPUTE_MAXS produces invalid class (verify error)
The input class is silly for sure, but is a valid class produced by sun javac.
Running the test program should get this verifier error:
Exception in thread "main" java.lang.VerifyError: (class: Foo, method: main
signature: ([Ljava/lang/String;)V) Stack size too large
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)
at java.lang.Class.getConstructor0(Class.java:2699)
at java.lang.Class.newInstance0(Class.java:326)
at java.lang.Class.newInstance(Class.java:308)
at Test.main(Test.java:18)
If you compile the Foo class with eclipse I don't think the problem will
happen. I used javac from sun's jdk1.5.0_15 on windows.
Looking at javap_output.txt for the original and out output bytes, it looks
like the max stack is getting calculated to be 0 even though the exception
block (which can't execute) does push something on the stack.
No patch for you this time, sorry. Maybe later