@Override public String toFIString(Unit u) { StringBuilder sb = new StringBuilder(); boolean printId = Utils.buildBoolProperty("petablox.printrel.printID", false); if (printId) sb.append("(" + indexOf(u) + ")"); String type; if(u instanceof JAssignStmt) type = "Assign"; else if(u instanceof JBreakpointStmt) type = "Breakpoint"; else if(u instanceof JGotoStmt) type = "Goto"; else if(u instanceof JIfStmt) type = "If"; else if(u instanceof JIdentityStmt) type = "Identity"; else if(u instanceof JInvokeStmt) type = "Invoke"; else if(u instanceof JLookupSwitchStmt) type = "LookupSwitch"; else if(u instanceof JNopStmt) type = "Nop"; else if(u instanceof JRetStmt) type = "Return"; else if(u instanceof JTableSwitchStmt) type = "TablelSwitch"; else if(u instanceof JThrowStmt) type = "Throw"; else type = "Other"; sb.append(type); sb.append(": " + SootUtilities.getMethod(u).getName() + "@" + SootUtilities.getMethod(u).getDeclaringClass().getName()); return sb.toString(); }
public static boolean isInvoke(Unit q){ if (q instanceof JInvokeStmt) return true; else if (q instanceof JAssignStmt) if ((((JAssignStmt)q).rightBox.getValue()) instanceof InvokeExpr) return true; return false; }
public static boolean isVirtualInvoke(Unit q){ assert (q instanceof JInvokeStmt || q instanceof JAssignStmt); InvokeExpr ie; if (q instanceof JInvokeStmt) ie = ((JInvokeStmt)q).getInvokeExpr(); else if (q instanceof JAssignStmt) ie = ((InvokeExpr)(((JAssignStmt)q).rightBox.getValue())); else ie = null; return ie != null && ie instanceof JVirtualInvokeExpr; }
public static boolean isInterfaceInvoke(Unit q){ assert (q instanceof JInvokeStmt || q instanceof JAssignStmt); InvokeExpr ie; if (q instanceof JInvokeStmt) ie = ((JInvokeStmt)q).getInvokeExpr(); else if (q instanceof JAssignStmt) ie = ((InvokeExpr)(((JAssignStmt)q).rightBox.getValue())); else ie = null; return ie != null && ie instanceof JInterfaceInvokeExpr; }
public static boolean isInstanceInvoke(Unit q){ assert (q instanceof JInvokeStmt || q instanceof JAssignStmt); InvokeExpr ie; if (q instanceof JInvokeStmt) ie = ((JInvokeStmt)q).getInvokeExpr(); else if (q instanceof JAssignStmt) ie = ((InvokeExpr)(((JAssignStmt)q).rightBox.getValue())); else ie = null; if (ie != null && ie instanceof InstanceInvokeExpr) return true; return false; }
public static boolean isStaticInvoke(Unit q){ assert (q instanceof JInvokeStmt || q instanceof JAssignStmt); InvokeExpr ie; if (q instanceof JInvokeStmt) ie = ((JInvokeStmt)q).getInvokeExpr(); else if (q instanceof JAssignStmt) ie = ((InvokeExpr)(((JAssignStmt)q).rightBox.getValue())); else ie = null; if (ie != null && ie instanceof StaticInvokeExpr) return true; return false; }
public static InvokeExpr getInvokeExpr(Unit q){ assert (q instanceof JInvokeStmt || q instanceof JAssignStmt); InvokeExpr ie; if (q instanceof JInvokeStmt) ie = ((JInvokeStmt)q).getInvokeExpr(); else if (q instanceof JAssignStmt) ie = ((InvokeExpr)(((JAssignStmt)q).rightBox.getValue())); else ie = null; return ie; }
public static Value getInstanceInvkBase(Unit q){ assert (q instanceof JInvokeStmt || q instanceof JAssignStmt); InvokeExpr ie; if (q instanceof JInvokeStmt) ie = ((JInvokeStmt)q).getInvokeExpr(); else if (q instanceof JAssignStmt) ie = ((InvokeExpr)(((JAssignStmt)q).rightBox.getValue())); else ie = null; if (ie != null && ie instanceof InstanceInvokeExpr) return ((InstanceInvokeExpr)ie).getBase(); return null; }
public static List<Value> getInvokeArgs (Unit q) { assert (q instanceof JInvokeStmt || q instanceof JAssignStmt); List<Value> args; if (q instanceof JInvokeStmt) args = ((JInvokeStmt)q).getInvokeExpr().getArgs(); else if (q instanceof JAssignStmt) args = ((InvokeExpr)(((JAssignStmt)q).rightBox.getValue())).getArgs(); else args = null; return args; }
@Test public final void testExtractLn() { Stmt statement1 = new JInvokeStmt(new JStaticInvokeExpr(sootMethod1C1.makeRef(), new ArrayList<Object>())); Tag tag1 = new SourceLnPosTag(8, 8, 3, 4); statement1.addTag(tag1); Stmt statement2 = new JReturnVoidStmt(); Tag tag2 = new SourceLnPosTag(532, 532, 3, 4); statement2.addTag(tag2); Stmt statement3 = new JReturnVoidStmt(); assertTrue("Correct line number", extractLineNumber(statement1) == 8); assertTrue("Correct line number", extractLineNumber(statement2) == 532); assertTrue("No line number present", extractLineNumber(statement3) == 0); }
public void visit(JInvokeStmt s) { add(s, s.getInvokeExpr()); }
@Override public void visit(JInvokeStmt s) {}
public void visit(JInvokeStmt s) {}
public void visit(JInvokeStmt q);