[Soot-list] Create a method with no arguments?

Eric Bodden eric.bodden at mail.mcgill.ca
Fri Jul 24 12:34:49 EDT 2009


Surely this should work:

method = new SootMethod("main",
new Type[0],
 VoidType.v(), Modifier.PUBLIC | Modifier.STATIC);

Eric

2009/7/24 Kelvin Tian <kevinn.tian at gmail.com>:
> Yes, I've tried to use an empty list. But
> java.lang.ArrayIndexOutOfBoundsException: 0  incurred.    It seems this way
> won't do.  Have anybody tried to create a method with no arguments before?
> Thanks,
>
> --
> Best regards,
> Kelvin
>
>
>
> On Wed, Jul 22, 2009 at 5:27 PM, Patrick Lam <plam at sable.mcgill.ca> wrote:
>>
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>>
>> Kelvin Tian wrote:
>> >  Hi,
>> >
>> >     Just a silly question.  I wanna create a method with no arguments,
>> > like this   void Foo().  The tutorial example to create main() method is
>> > like below, and the second argument is a list, like below.
>> > ===
>> > method = new SootMethod("main",
>> > Arrays.asList(new Type[] {ArrayType.v(RefType.v("java.lang.String"),
>> > 1)}),
>> >  VoidType.v(), Modifier.PUBLIC | Modifier.STATIC);
>> > ===
>> >
>> > If I want to create a method with no arguments, what am I supposed to
>> > put as the second argument of SootMethod constructor?   I tried null,
>> > VoidType.v() and so on, it just doesn't work.  Thanks for any
>> > suggestions!
>>
>> Have you tried just an empty list? new SootMethod("main", new
>> LinkedList()); for instance, or Collections.emptyList().
>>
>> pat
>> -----BEGIN PGP SIGNATURE-----
>> Version: GnuPG v1.4.9 (GNU/Linux)
>> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>>
>> iEYEARECAAYFAkpnhFYACgkQNTVxnNGEyOh5mQCeJU5/oS2re0S7FenFqKKL5M9R
>> SEIAn1o7WHEyQ25khuxA39IqtuguoC/N
>> =yhQ5
>> -----END PGP SIGNATURE-----
>
>
> _______________________________________________
> Soot-list mailing list
> Soot-list at sable.mcgill.ca
> http://mailman.cs.mcgill.ca/mailman/listinfo/soot-list
>
>



-- 
Eric Bodden
Sable Research Group, McGill University
Montréal, Québec, Canada


More information about the Soot-list mailing list