@Override public void caseThrowStmt(ThrowStmt stmt) { // add constraint DalvikTyper.v().setType(stmt.getOpBox(), RefType.v("java.lang.Object"), true); }
public void convert(DavaBody body) { Iterator it = body.getUnits().iterator(); while (it.hasNext()) { Unit u = (Unit) it.next(); if (u instanceof ThrowStmt) { ValueBox opBox = ((ThrowStmt) u).getOpBox(); Value op = opBox.getValue(); if (op.getType() instanceof NullType) { opBox.setValue(new DNewInvokeExpr(npeRef, null, new ArrayList())); } } } } }
public void caseThrowStmt(ThrowStmt s) { inThrowStmt(s); caseExprOrRefValueBox(s.getOpBox()); // decideCaseExprOrRef(s.getOp()); outThrowStmt(s); }
public soot.jimple.ThrowStmt newThrowStmt(Value op, ASTNode location) { soot.jimple.ThrowStmt stmt = Jimple.v().newThrowStmt(op); soot.tagkit.Tag tag = getTag(op); if(tag != null) stmt.getOpBox().addTag(tag); return stmt; }
/** * Throw Stmt Creation */ private void createThrow(polyglot.ast.Throw throwStmt) { soot.Value toThrow = base().createAggressiveExpr(throwStmt.expr(), false, false); soot.jimple.ThrowStmt throwSt = soot.jimple.Jimple.v().newThrowStmt(toThrow); body.getUnits().add(throwSt); Util.addLnPosTags(throwSt, throwStmt.position()); Util.addLnPosTags(throwSt.getOpBox(), throwStmt.expr().position()); }
protected void checkThrow(Body b, ThrowStmt ts) { if (isThrowDeclared(b, ((RefType) ts.getOp().getType()).getSootClass()) || isThrowFromCompiler(ts) || isExceptionCaught(b, ts, (RefType) ts.getOp().getType())) { return; } if (reporter != null) { reporter.reportError(new ExceptionCheckerError(b.getMethod(), ((RefType) ts.getOp().getType()).getSootClass(), ts, (SourceLnPosTag) ts.getOpBox().getTag("SourceLnPosTag"))); } }
javafy(((IfStmt) s).getConditionBox()); } else if (s instanceof ThrowStmt) { javafy(((ThrowStmt) s).getOpBox()); } else if (s instanceof TableSwitchStmt) { javafy(((TableSwitchStmt) s).getKeyBox());
protected void checkThrow(Body b, ThrowStmt ts){ if (isThrowDeclared(b, ((RefType)ts.getOp().getType()).getSootClass()) || isThrowFromCompiler(ts) || isExceptionCaught(b, ts, (RefType)ts.getOp().getType())) return; if (reporter != null){ reporter.reportError(new ExceptionCheckerError(b.getMethod(), ((RefType)ts.getOp().getType()).getSootClass(), ts, (SourceLnPosTag)ts.getOpBox().getTag("SourceLnPosTag"))); } }
protected void checkThrow(Body b, ThrowStmt ts){ if (isThrowDeclared(b, ((RefType)ts.getOp().getType()).getSootClass()) || isThrowFromCompiler(ts) || isExceptionCaught(b, ts, (RefType)ts.getOp().getType())) return; if (reporter != null){ reporter.reportError(new ExceptionCheckerError(b.getMethod(), ((RefType)ts.getOp().getType()).getSootClass(), ts, (SourceLnPosTag)ts.getOpBox().getTag("SourceLnPosTag"))); } }