jshrink/jshrink-lib/src/main/java/edu/ucla/cs/jshrinklib/methodinliner/MethodInliner.java
//Returns the statements, and whether they are an dynamic invocation or not.
Returns the statements, and whether they are an dynamic invocation or not.
Returns the statements and whether they are an dynamic invocation or not .
private static List<Map.Entry<Stmt, Boolean>> toInline(Body b, SootMethod callee){
		List<Map.Entry<Stmt, Boolean>> toReturn = new ArrayList<Map.Entry<Stmt, Boolean>>();
		for (Unit u : b.getUnits()) {
			InvokeExpr invokeExpr = null;
			if(u instanceof InvokeStmt){
				invokeExpr = ((InvokeStmt)u).getInvokeExpr();
			} else if(u instanceof JAssignStmt && ((JAssignStmt)u).containsInvokeExpr()){
				invokeExpr = ((JAssignStmt) u).getInvokeExpr();
			}
			if(invokeExpr != null){
				SootMethod sootMethod = invokeExpr.getMethod();
				if(invokeExpr instanceof  DynamicInvokeExpr || invokeExpr instanceof VirtualInvokeExpr){
					if(sootMethod.getSubSignature().equals(callee.getSubSignature())){
						toReturn.add(new HashMap.SimpleEntry<Stmt, Boolean>((Stmt) u, true));
					}
				} else {
					if(sootMethod.equals(callee)){
						toReturn.add(new HashMap.SimpleEntry<Stmt, Boolean>((Stmt) u, false));
					}
				}
			}
		}
		return toReturn;
	}
private static List < Map . Entry < Stmt , Boolean > > toInline ( Body b , SootMethod callee ) { List < Map . Entry < Stmt , Boolean > > toReturn = new ArrayList < Map . Entry < Stmt , Boolean > > ( ) ; for ( Unit u : b . getUnits ( ) ) { InvokeExpr invokeExpr = null ; if ( u instanceof InvokeStmt ) { invokeExpr = ( ( InvokeStmt ) u ) . getInvokeExpr ( ) ; } else if ( u instanceof JAssignStmt && ( ( JAssignStmt ) u ) . containsInvokeExpr ( ) ) { invokeExpr = ( ( JAssignStmt ) u ) . getInvokeExpr ( ) ; } if ( invokeExpr != null ) { SootMethod sootMethod = invokeExpr . getMethod ( ) ; if ( invokeExpr instanceof DynamicInvokeExpr || invokeExpr instanceof VirtualInvokeExpr ) { if ( sootMethod . getSubSignature ( ) . equals ( callee . getSubSignature ( ) ) ) { toReturn . add ( new HashMap . SimpleEntry < Stmt , Boolean > ( ( Stmt ) u , true ) ) ; } } else { if ( sootMethod . equals ( callee ) ) { toReturn . add ( new HashMap . SimpleEntry < Stmt , Boolean > ( ( Stmt ) u , false ) ) ; } } } } return toReturn ; }
Returns the statements, and whether they are an dynamic invocation or not.
Returns the statements and whether they are an dynamic invocation or not .