[Soot-list] compilation error: isJavaLibraryMethod() is undefined for the type SootMethod

Richard Xiao richardxx at cse.ust.hk
Mon May 27 23:03:13 EDT 2013


Hi, John:

Please look at the latest source in Github. This method is added in version
2.5. Please copy and paste to your SootMethod.java.

Cheers,
Xiao




On Tue, May 28, 2013 at 10:32 AM, Dean, John <John.Dean at park.edu> wrote:

> Quentin (or anyone else?),
>
> I've written my new code with your suggested call to
> isJavaLibraryMethod(). Eclipse shows a red x next to the line that contains
> the method call and when I compile, I get this error:
>
> The method isJavaLibraryMethod() is undefined for the type SootMethod
>      [iajc] if (!method.isJavaLibraryMethod())
>      [iajc]             ^^^^^^^^^^^^^^
>
> I installed soot several years ago and I haven't bothered to install  a
> newer version since then.
> I searched for the word "soot" in my installation folder, and I see a jar
> file named soot-2.2.1-dev-20050224232207.jar. Thus, I think I am using soot
> version 2.2.1.
> I looked at soot's changes web page (
> http://www.sable.mcgill.ca/soot/CHANGES) and I don't think I see anything
> relevant for SootMethod or isJavaLibraryMethod, but maybe I'm not looking
> correctly.
>
> Suggestions?
>
> Thanks,
> John
>
> -----Original Message-----
> From: soot-list-bounces at sable.mcgill.ca [mailto:
> soot-list-bounces at sable.mcgill.ca] On Behalf Of Quentin Sabah
> Sent: Sunday, May 26, 2013 6:17 AM
> Cc: soot-list at sable.mcgill.ca
> Subject: Re: [Soot-list] How check for method calls such that the method
> call is defined in a particular class?
>
> Hi John,
>
> > I want to check all the statements in a method and for each statement,
> check whether it contains a method call that comes from the System class or
> the Math class (e.g., System.out.println or Math.abs). Or if you know how
> to determine whether the method comes from any class in the standard Java
> API, that's even better. I need to separate "safe" method calls (e.g.,
> System.out.println) from method calls whose methods are not part of the
> standard Java API. I suppose if I can identify just method calls from
> System and Math, that's good enough.
>
> The SootMethod objects have a very handy isJavaLibraryMethod() method
> doing just what you need.
>
> > I tried checking each statement with instanceof JInvokeStmt, but oddly,
> that matches only Jimple-generated methods that have the name "<init>" (I
> don't understand the "<init>" method, but that's OK).
>
> <init> is the name for constructor methods, it is in the Java
> Specification.
>
> > 1. How should I extract the expressions from the statement? I see there
> is a getInvokeExpr() method in the soot.jimple.Stmt interface, but the api
> doesn't say what happens if the statement can't find an invokeExpr. Does it
> return -1?
>
> Yes, use getInvokeExpr(), I guess it will return null if the statement has
> no invoke expression (try and you'll see anyway). How could it return -1,
> the javadoc says it returns an InvokeExpr reference!
>
> > 2. Once I have a JVirtualInvokeExpr, how can I retrieve the method's
> containing class? For example, if the invoking expression is
> System.out.println, how can I retrieve "System"? I tried using getName (for
> JInvokeStmt), and it returns just the method name without the class (e.g.,
> println). If you know how to retrieve the entire System.out.println, that's
> good enough because I can use indexOf to search for "System". Should I use
> SootMethod's getSignature and search for "System" using indexOf?
>
>
> Let say getInvokeExpr() returned you an object with the InvokeExpr
> interface. There is the getMethod() method that returns a SootMethod
> instance. From there, use isJavaLibraryMethod() or getDeclaringClass() or
> refer to the API.
>
> Regards.
>
> --
> Quentin Sabah, CIFRE Ph.D. student
> Grenoble University
> INRIA-SARDES                   | STMicroelectronics/AST
> Montbonnot, France             | Grenoble, France
> mailto:quentin.sabah at inria.fr  | mailto:quentin.sabah at st.com
> phone: +33 476 61 52 42        | phone: +33 476 58 44 14
>
> _______________________________________________
> Soot-list mailing list
> Soot-list at sable.mcgill.ca
> http://mailman.cs.mcgill.ca/mailman/listinfo/soot-list
> _______________________________________________
> Soot-list mailing list
> Soot-list at sable.mcgill.ca
> http://mailman.cs.mcgill.ca/mailman/listinfo/soot-list
>



-- 
Richard Xiao Xiao
PhD Student @ CSE @ Hong Kong University of Science and Technology
www.cse.ust.hk/~richardxx
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.cs.mcgill.ca/pipermail/soot-list/attachments/20130528/d2f17b2b/attachment-0001.html 


More information about the Soot-list mailing list