当前位置: 首页>>代码示例>>Java>>正文


Java ThrowStmt.setOp方法代码示例

本文整理汇总了Java中soot.jimple.ThrowStmt.setOp方法的典型用法代码示例。如果您正苦于以下问题:Java ThrowStmt.setOp方法的具体用法?Java ThrowStmt.setOp怎么用?Java ThrowStmt.setOp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在soot.jimple.ThrowStmt的用法示例。


在下文中一共展示了ThrowStmt.setOp方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testJThrowStmt

import soot.jimple.ThrowStmt; //导入方法依赖的package包/类
@Test
public void testJThrowStmt() {

    // First test with an argument that is included in
    // PERENNIAL_THROW_EXCEPTIONS.
    ThrowStmt s = Jimple.v().newThrowStmt(Jimple.v().newLocal("local0", 
                RefType.v("java.lang.NullPointerException")));
    Set expectedRep = new ExceptionHashSet(utility.PERENNIAL_THROW_EXCEPTIONS);
    expectedRep.remove(utility.NULL_POINTER_EXCEPTION);
    expectedRep.add(AnySubType.v(utility.NULL_POINTER_EXCEPTION));
    assertTrue(ExceptionTestUtility.sameMembers(expectedRep, Collections.EMPTY_SET,
                unitAnalysis.mightThrow(s)));
    assertEquals(utility.PERENNIAL_THROW_EXCEPTIONS_PLUS_SUPERTYPES,
            utility.catchableSubset(unitAnalysis.mightThrow(s)));

    // Throw a local of type IncompatibleClassChangeError.
    Local local = Jimple.v().newLocal("local1", 
            utility.INCOMPATIBLE_CLASS_CHANGE_ERROR);
    s.setOp(local);
    expectedRep = new ExceptionHashSet(utility.THROW_PLUS_INCOMPATIBLE_CLASS_CHANGE);
    expectedRep.remove(utility.INCOMPATIBLE_CLASS_CHANGE_ERROR);
    expectedRep.add(AnySubType.v(utility.INCOMPATIBLE_CLASS_CHANGE_ERROR));
    assertTrue(ExceptionTestUtility.sameMembers(expectedRep, Collections.EMPTY_SET,
                unitAnalysis.mightThrow(s)));
    assertEquals(utility.THROW_PLUS_INCOMPATIBLE_CLASS_CHANGE_PLUS_SUBTYPES_PLUS_SUPERTYPES, 
            utility.catchableSubset(unitAnalysis.mightThrow(s)));

    // Throw a local of unknown type.
    local = Jimple.v().newLocal("local1", soot.UnknownType.v());
    s.setOp(local);
    assertTrue(ExceptionTestUtility.sameMembers(utility.ALL_THROWABLES_REP, 
                Collections.EMPTY_SET,
                unitAnalysis.mightThrow(s)));
    assertEquals(utility.ALL_TEST_THROWABLES, 
            utility.catchableSubset(unitAnalysis.mightThrow(s)));
}
 
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:37,代码来源:UnitThrowAnalysisTest.java

示例2: caseThrowStmt

import soot.jimple.ThrowStmt; //导入方法依赖的package包/类
public void caseThrowStmt(ThrowStmt stmt)
{
	stmt.setOp(this.uv.visit(
		stmt.getOp(), RefType.v("java.lang.Throwable"), stmt));
}
 
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:6,代码来源:UseChecker.java

示例3: testGThrowStmt

import soot.jimple.ThrowStmt; //导入方法依赖的package包/类
@Test
public void testGThrowStmt() {
    ThrowStmt s = Grimp.v().newThrowStmt(Grimp.v().newLocal("local0", 
                RefType.v("java.util.zip.ZipException")));

    Set expectedRep = new ExceptionHashSet(utility.PERENNIAL_THROW_EXCEPTIONS);
    expectedRep.add(AnySubType.v(Scene.v().getRefType("java.util.zip.ZipException")));
    assertTrue(ExceptionTestUtility.sameMembers(expectedRep, Collections.EMPTY_SET,
                unitAnalysis.mightThrow(s)));

    Set expectedCatch = new ExceptionHashSet(utility.PERENNIAL_THROW_EXCEPTIONS_PLUS_SUPERTYPES);
    // We don't need to add java.util.zip.ZipException, since it is not
    // in the universe of test Throwables.
    assertEquals(expectedCatch, 
            utility.catchableSubset(unitAnalysis.mightThrow(s)));

    // Now throw a new IncompatibleClassChangeError.
    s = Grimp.v().newThrowStmt(
            Grimp.v().newNewInvokeExpr(
                utility.INCOMPATIBLE_CLASS_CHANGE_ERROR,
                Scene.v().makeMethodRef(utility.INCOMPATIBLE_CLASS_CHANGE_ERROR.getSootClass(),
                    "void <init>", Collections.EMPTY_LIST, 
                    VoidType.v(), false),
                new ArrayList()
                )
            );
    assertTrue(ExceptionTestUtility.sameMembers(utility.THROW_PLUS_INCOMPATIBLE_CLASS_CHANGE, 
                Collections.EMPTY_SET,
                unitAnalysis.mightThrow(s)));
    assertEquals(utility.THROW_PLUS_INCOMPATIBLE_CLASS_CHANGE_PLUS_SUPERTYPES, 
            utility.catchableSubset(unitAnalysis.mightThrow(s)));

    // Throw a local of type IncompatibleClassChangeError.
    Local local = Grimp.v().newLocal("local1", 
            utility.INCOMPATIBLE_CLASS_CHANGE_ERROR);
    s.setOp(local);
    expectedRep = new ExceptionHashSet(utility.PERENNIAL_THROW_EXCEPTIONS);
    expectedRep.remove(utility.INCOMPATIBLE_CLASS_CHANGE_ERROR);
    expectedRep.add(AnySubType.v(utility.INCOMPATIBLE_CLASS_CHANGE_ERROR));
    assertTrue(ExceptionTestUtility.sameMembers(expectedRep, Collections.EMPTY_SET,
                unitAnalysis.mightThrow(s)));
    assertEquals(utility.THROW_PLUS_INCOMPATIBLE_CLASS_CHANGE_PLUS_SUBTYPES_PLUS_SUPERTYPES, 
            utility.catchableSubset(unitAnalysis.mightThrow(s)));

    // Throw a local of unknown type.
    local = Jimple.v().newLocal("local1", soot.UnknownType.v());
    s.setOp(local);
    assertTrue(ExceptionTestUtility.sameMembers(utility.ALL_THROWABLES_REP, 
                Collections.EMPTY_SET,
                unitAnalysis.mightThrow(s)));
    assertEquals(utility.ALL_TEST_THROWABLES, 
            utility.catchableSubset(unitAnalysis.mightThrow(s)));
}
 
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:54,代码来源:UnitThrowAnalysisTest.java


注:本文中的soot.jimple.ThrowStmt.setOp方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。