[Soot-list] Constructor with parameters (JNewExpr) ?

Eric Bodden bodden at st.informatik.tu-darmstadt.de
Sat Jun 12 07:27:55 EDT 2010


Hi Cristina.

In bytecode (and Jimple), a constructor call "x = new X(a,b)" is
modeled as sequence of *two* statements, one new-statement and one
invokespecial-statement that calls the constuctor:

x = new X;
invokespecial x.<init>(a,b);

So after your new statement just create an appropriate JInvokeStmt
with a JSpecialInvokeExpr.

Eric

--
Dr. 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



On 12 June 2010 09:46, Cristina Ilie <crysgirlro at yahoo.com> wrote:
> Hi,
>
> How do add parameters when I instantiate an object of a class created by me.
> I did so:
>                         RefType parameter = RefType.v("DerivType");
>                         locSExprDTRHS[i] = new JNewExpr(parameter);
>
> JNewExpr will contain: new DerivType - but I want to give some parameters (I
> have 2 constructors for the class DerivType).
>
> Thanks,
> Cristina
>
>
> _______________________________________________
> 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