Sable/jasmin — pull request #1 by uberfluffy (2012-09-20 16:02:20+00:00)
Title: EnclosingMethod attribute

I believe I have found an edge condition error in how Soot uses Jasmin to output assembled class files. The custom version of Jasmin distributed with Soot doesn't ever allow the EnclosingMethod attribute of an inner class to be zero.

According to the Java class file spec [1], the EnclosingMethod attribute specifies "If the current class is not immediately enclosed by a method or constructor, then the value of the method_index item must be zero."

While Soot correctly passes EnclosingMethod tags with an empty method (e.g. ".enclosing_method_attr " "myClass" "" ""\n" ), the custom Jasmin creates an empty string in the class' constant pool and makes a reference to that. [2]

This bug was fixed at least as early as Jasmin version 2.0 [3]. I changed the EnclMethAttr class to make the same fix, using the current field names.

[1] http://docs.oracle.com/javase/specs/jvms/se7/html/jvms-4.html#jvms-4.7.7
[2] https://github.com/Sable/jasmin/blob/master/lib/jas/src/jas/EnclMethAttr.java
[3] http://sourceforge.net/projects/jasmin/files/jasmin/2.0/