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

Re: help



I'm assuming that you are looking for the declared type of a. When the
program runs, the actual object could be any subtype of it.

You will first need to make sure your InvokeExpr is an
InstanceInvokeExpr. An InstanceInvokeExpr has a receiver; an InvokeExpr
may not, if it is a call to a static method, for example. From an
InstanceInvokeExpr, you can call getBase() to get the receiver of the
call (the a, in your example). You then call getType() on it to get its
declared type. You should be able to cast the type to a RefType,
and then call getSootClass() on it to get the corresponding SootClass.

Hope that helps.

Ondrej

On Fri, Dec 13, 2002 at 12:28:02PM -0500, Matthew J Rummel wrote:
>    Mr. Soot,
>     
>    I have a question regarding InvokeExprs.  (At least I think they are
>    called InvokeExprs).  Say you have an expression in the code where 'a' is
>    an instance of a class and 'doSomthing()' is a method in that class:
>     
>    a.doSomthing()
>     
>    its it possible to get the SootClass that a is an instance of every time
>    you come across a call to a method like this?  I have look through the API
>    and cannot come up with a good way to do this.
>     
>     
>     
>    -Matt