[Soot-list] SOOT getMethodbyName() problem

Quentin Sabah quentin.sabah at inria.fr
Mon Apr 15 05:16:03 EDT 2013


Hi Abdejalil, I post my response to the mailing list since it might help 
other users in the future.

On 04/15/2013 10:56 AM, Abdejalil SETH wrote:
> Hi Quentin,
>
> thank you for your response, I try to use :
> java.lang.reflect.AccessibleObject or java.lang.reflect.FIield
>
> this is my code :
>
>     I try to analyze the CallGraph :
>
>
>     CallGraphExample : http://pastebin.com/43sq3fnz
>
>     FieldAccessible.java : http://pastebin.com/nEzZAAzV
>
>
>     OUTPUT :
>
>     Exception in thread "main" java.lang.RuntimeException: ambiguous method
>

Here Soot tells you that there is more than one method corresponding to 
the name you are looking for ("ambiguous method"). If you take a look at 
java.lang.reflect.AccessibleObject, you will indeed observe the 
setAccessible method is overloaded. In this case, you have to 
disambiguate your query, by using one of the SootClass.getMethod(..) 
variants.

I suggest you use getMethod(String name, List parameterTypes), you just 
have to provide a list of Soot.Type, like:

    List parameterTypes = new ArrayList();
    parameterTypes.add(Soot.BooleanType.v());
    ... = ...getMethod("setAccessible", parameterTypes);

Regards.

-- 
Quentin Sabah, CIFRE Ph.D. student
Grenoble University
INRIA-SPADES                   | STMicroelectronics/AST
Montbonnot, France             | Grenoble, France
mailto:quentin.sabah at inria.fr  | mailto:quentin.sabah at st.com
phone: +33 476 61 54 57        | phone: +33 476 58 44 14


More information about the Soot-list mailing list