[Soot-list] Truncated class file

Eduardo S. Cordeiro cordeiro at dcc.ufmg.br
Mon May 8 12:12:32 EDT 2006


I wrote a SceneTransformer which takes classes and finds identical 
methods to remove replicas, keeping only one instance of each replica 
pair (or triple, etc). The transformer first removes the methods and 
then replaces calls to removed methods by calls to the remaining ones 
they were replicas of. Call replacement is made by changing the 
SootMethodRef object associated with an InvokeExpr.

When I open the resulting class files in a class file viewer, such as 
jclasslib, everything seems in order; I've checked the constant pool 
information, method bodies and the initial bytes which give method count 
and constant pool size and found no problem. But when I try to run 
transformed programs on the VMs specified below (those I have access 
to), a java.lang.ClassFormatException is thrown, with the message 
"Truncated class file", which is apparently thrown from the <clinit> of 
the main class.

Have I used the wrong strategy to remove these methods (hopefully) or is 
this a bug with method removal (please no)?

Thanks and regards,
Eduardo Cordeiro

Tested VMs: Sun JDKs 1.4.1_01 and 1.5.0_05 (Windows) and 1.5.0_06 (Linux).


More information about the Soot-list mailing list