[Soot-list] SootClass.getMethod("<init>") can not find the constructor

Dhriti Khanna dhritik at iiitd.ac.in
Sun Dec 29 06:59:29 EST 2019


Hello,
I have a class called ResourceStoreManager, in which a constructor with the
following signature:

public ResourceStoreManager (String server_name,
  File stredir,
  String default_root_class,
  String default_root_name,
  String serializer_class,
*  //int max_loaded_store,*
*  //int store_size_limit,*
  Hashtable defs)

I am using the following code (displaying only the relevant part of the
code) to extract this method from the class:

SootClass sootClass = Scene.v().forceResolve(_cut, SootClass.BODIES);
sootClass.setApplicationClass();
Scene.v().loadNecessaryClasses();
SootMethod m;
try {
*   m = sootClass.getMethod(apiName, list);*
}
catch(RuntimeException a) {
  System.out.println(a);
  return;
}

Here, apiName = <init> and list = [java.lang.String, java.io.File,
java.lang.String, java.lang.String, java.lang.String, *int, int*,
java.util.Hashtable]

The problem is that when the list contains the above parameterTypes, then
the following exception occurs: couldn't find method <init>

Only with these parameterTypes: [java.lang.String, java.io.File,
java.lang.String, java.lang.String, java.lang.String, *java.lang.Integer,
java.lang.Integer*, java.util.Hashtable]), the method is retrieved.

Note: This list is formed using the function: api.getParameterTypes() at
some earlier point in my codebase.
Please resolve.

-- 
Regards
Dhriti Khanna
PhD Scholar
IIIT Delhi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.CS.McGill.CA/pipermail/soot-list/attachments/20191229/b4dc6474/attachment.html>


More information about the Soot-list mailing list