2424import org .slf4j .LoggerFactory ;
2525
2626import soot .Body ;
27- import soot .Hierarchy ;
2827import soot .Local ;
2928import soot .Modifier ;
3029import soot .RefType ;
5857import soot .jimple .infoflow .data .SootMethodAndClass ;
5958import soot .jimple .infoflow .entryPointCreators .IEntryPointCreator ;
6059import soot .jimple .infoflow .entryPointCreators .SimulatedCodeElementTag ;
60+ import soot .jimple .infoflow .typing .TypeUtils ;
6161import soot .jimple .infoflow .util .SootMethodRepresentationParser ;
6262import soot .jimple .infoflow .util .SystemClassHandler ;
6363import soot .jimple .toolkits .scalar .NopEliminator ;
@@ -339,7 +339,6 @@ protected SootMethod createDummyMainInternal() {
339339
340340 private void createJavascriptCallbacks () {
341341 Jimple j = Jimple .v ();
342- Hierarchy h = Scene .v ().getActiveHierarchy ();
343342 for (SootMethod m : javascriptInterfaceStmts .keySet ()) {
344343 Set <Stmt > statements = javascriptInterfaceStmts .get (m );
345344 for (Stmt s : statements ) {
@@ -364,16 +363,18 @@ private void createJavascriptCallbacks() {
364363 Stmt assignF = j .newAssignStmt (l , j .newStaticFieldRef (f .makeRef ()));
365364 body .getUnits ().add (assignF );
366365 SootClass cbtype = ((RefType ) f .getType ()).getSootClass ();
367- Set <SootMethod > allPossibleImpls = Scene .v ().getOrMakeFastHierarchy ().resolveAbstractDispatch (cbtype ,
368- m );
369- for (SootMethod cbm : allPossibleImpls ) {
370- if (AndroidEntryPointUtils .isCallableFromJS (cbm )) {
371- List <Value > args = new ArrayList <>();
372- for (Type t : cbm .getParameterTypes ())
373- args .add (getSimpleDefaultValue (t ));
374- InvokeStmt st = j .newInvokeStmt (j .newVirtualInvokeExpr (l , cbm .makeRef (), args ));
375- body .getUnits ().add (st );
366+
367+ for (SootClass c : TypeUtils .getAllDerivedClasses (cbtype )) {
368+ for (SootMethod cbm : c .getMethods ()) {
369+ if (AndroidEntryPointUtils .isCallableFromJS (cbm )) {
370+ List <Value > args = new ArrayList <>();
371+ for (Type t : cbm .getParameterTypes ())
372+ args .add (getSimpleDefaultValue (t ));
373+ InvokeStmt st = j .newInvokeStmt (j .newVirtualInvokeExpr (l , cbm .makeRef (), args ));
374+ body .getUnits ().add (st );
375+ }
376376 }
377+
377378 }
378379 createIfStmt (assignF );
379380
0 commit comments