[Soot-list] cast soot.SootClass to Local variable

Eric Bodden bodden at st.informatik.tu-darmstadt.de
Wed Dec 2 08:27:03 EST 2009


Hi.

If your target machine does not support class constants, then you
basically have to do what pre-Java-1.4 compilers did: insert calls to
Class.forName(..) to retrieve the class constant object at runtime.

Eric

--
Eric Bodden
Software Technology Group, Technische Universität Darmstadt, Germany
Tel: +49 6151 16-5478    Fax: +49 6151 16-5410
Mailing Address: S2|02 A209, Hochschulstraße 10, 64289 Darmstadt



2009/12/1 Zhang Yixi <zhangy16 at rpi.edu>:
> Hi all,
> I'm trying to fix my code for a programming assignment. My question is how
> to convert the SootClass static_class to a soot.Value variable can use as
> the newStaticInvokeExpr()'s third argument. The restriction is cant use
> ClassConstant.v() because our remote machine doesn't support that. What I
> have is
> private static String tracker_name = "RuntimeTracker";
> private static SootMethod before_call_vi;
> tracker_class = Scene.v().getSootClass(tracker_name);
> before_call_vi =tracker_class.getMethod("void
> beforeCall(java.lang.String,java.lang.Object)");
> Value receiver_expr = ((InstanceInvokeExpr)c).getBase();
> Type static_type = receiver_expr.getType();
> SootClass static_class = ((RefType)static_type).getSootClass();
> sc =
> Jimple.v().newStaticInvokeExpr(before_call_vi,StringConstant.v(call_id),static_class);
> The compile error is
> "Explicit cast needed to convert soot.SootClass to soot.Value."
> _______________________________________________
> Soot-list mailing list
> Soot-list at sable.mcgill.ca
> http://mailman.cs.mcgill.ca/mailman/listinfo/soot-list
>
>


More information about the Soot-list mailing list