[Soot-list] Deep-copy & Cloning problem

Emil Slusanschi slusanschi at sc.rwth-aachen.de
Fri Dec 10 06:31:52 EST 2004


Hi,

I have a small problem when trying to implement a deep copy via cloning. 
In this example, I have a "double" (value) and a "double []" (vector). 
When I want to clone the "CloneTest" class, I need to implement the deep 
copy via cloning for the vector too so that I won't copy just references 
for the vector field.

The problem is, that when I try to just get a jimple output that I can 
work with using:

java soot.Main -f J --soot-classpath 
.:gnu-crypto-2.0.1-bin/lib/javax-crypto.jar:/usr/java/jre1.5.0/ CloneTest

then I get something like:

Soot started on Fri Dec 10 12:28:17 CET 2004
Transforming CloneTest...
Exception in thread "main" java.lang.RuntimeException:
Aborting: can't find classfile[D
         at soot.Scene.getSootClass(Scene.java:300)
         at soot.coffi.CFG.generateJimple(CFG.java:4434)
         at soot.coffi.CFG.jimplify(CFG.java:1463)
         at soot.coffi.CFG.jimplify(CFG.java:1126)
         at soot.coffi.CoffiMethodSource.getBody(CoffiMethodSource.java:98)
         at soot.SootMethod.getBodyFromMethodSource(SootMethod.java:79)
         at soot.SootMethod.retrieveActiveBody(SootMethod.java:274)
         at soot.PackManager.runBodyPacks(PackManager.java:477)
         at soot.PackManager.runBodyPacks(PackManager.java:318)
         at soot.PackManager.runPacks(PackManager.java:278)
         at soot.Main.run(Main.java:180)
         at soot.Main.main(Main.java:154)

Does anyone has an idea what the problem is and how can I solve it? Am I 
doing something wrong here? And yes, I am using Soot 2.1.0. If this 
problem is solved with the new Soot release then all is ok :P

Thanks,

Emil

PS. Here is my CloneTest class:

class CloneTest implements Cloneable
{
     public double value;
     public static final int dimension;
     public double[] vector;

     public Object clone(){
	CloneTest o = null;
	try {
	    o = (CloneTest)super.clone();
	    o.vector = (double [])vector.clone();
	}
	catch (CloneNotSupportedException e) {
	    System.err.println("CloneTest can't clone.");
	}
	return o;
     }

     public CloneTest()
     {
         super();

         int i;

         i = dimension;
         vector = new double[i];
         return;
     }

     static
     {
         dimension = 3;
     }
}





More information about the Soot-list mailing list