[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

New instance of a class and specialinvoke for <init>



Hi,

in my original java code I have something like:

MyClass z;

z = new MyClass();

and in the jimple IR I get:

MyClass z;

        z = new MyClass;
        specialinvoke z.<MyClass: void <init>()>();


All good and well but now I want to make my transformer change MyClass objects into, let's say, MyClass2. This means that for each instance where MyClass is in a statement, I want to build a new statement with MyClass2 instead and erase the statement containing MyClass. I've generated/replaced successfully:


MyClass2 z2;

z2 = new MyClass2;

but I'm not able to get the:

specialinvoke z2.<MyClass2: void <init>()>();

invoke generated. Does somebody have an idea how can I get this done? Method <init> is not a _real_ method and that's why I can't get it with z2(Handler).getMethod(*).

Thanks,

Emil