Search in sources :

Example 1 with Scene

use of soot.Scene in project soot by Sable.

the class SootASMClassWriterTest method setUp.

@Before
public void setUp() throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException {
    mockStatic(Scene.class);
    mockStatic(RefType.class);
    mockStatic(UnknownType.class);
    scene = mock(Scene.class);
    when(Scene.v()).thenReturn(scene);
    UnknownType unknown = mock(UnknownType.class);
    when(UnknownType.v()).thenReturn(unknown);
    sc1 = mockClass("A");
    sc2 = mockClass("B");
    type1 = RefType.v("A");
    type2 = RefType.v("B");
    object = mockClass("java.lang.Object");
    objectType = mock(RefType.class);
    when(object.getType()).thenReturn(objectType);
    when(Scene.v().getObjectType()).thenReturn(objectType);
    when(objectType.getSootClass()).thenReturn(object);
    when(objectType.getClassName()).thenReturn("java.lang.Object");
    when(type1.merge(type2, scene)).thenCallRealMethod();
    commonSuperClass = mockClass("C");
    commonSuperClass.setResolvingLevel(SootClass.HIERARCHY);
    when(commonSuperClass.getSuperclass()).thenReturn(object);
    when(commonSuperClass.getSuperclassUnsafe()).thenReturn(object);
    cw = mock(SootASMClassWriter.class);
    when(cw.getCommonSuperClass("A", "B")).thenCallRealMethod();
}
Also used : UnknownType(soot.UnknownType) RefType(soot.RefType) Scene(soot.Scene) Before(org.junit.Before)

Example 2 with Scene

use of soot.Scene in project soot by Sable.

the class ThrowSet method initThrowables.

private static void initThrowables() {
    Scene sc = Scene.v();
    throwable = new SootClass[10];
    throwable[0] = sc.getRefType("java.lang.RuntimeException").getSootClass();
    throwable[1] = sc.getRefType("java.lang.ArithmeticException").getSootClass();
    throwable[2] = sc.getRefType("java.lang.ArrayStoreException").getSootClass();
    throwable[3] = sc.getRefType("java.lang.ClassCastException").getSootClass();
    throwable[4] = sc.getRefType("java.lang.IllegalMonitorStateException").getSootClass();
    throwable[5] = sc.getRefType("java.lang.IndexOutOfBoundsException").getSootClass();
    throwable[6] = sc.getRefType("java.lang.ArrayIndexOutOfBoundsException").getSootClass();
    throwable[7] = sc.getRefType("java.lang.NegativeArraySizeException").getSootClass();
    throwable[8] = sc.getRefType("java.lang.NullPointerException").getSootClass();
    throwable[9] = sc.getRefType("java.lang.Throwable").getSootClass();
}
Also used : Scene(soot.Scene)

Aggregations

Scene (soot.Scene)2 Before (org.junit.Before)1 RefType (soot.RefType)1 UnknownType (soot.UnknownType)1