Search in sources :

Example 1 with DInstanceFieldRef

use of soot.dava.internal.javaRep.DInstanceFieldRef in project soot by Sable.

the class DavaBody method javafy_ref.

private void javafy_ref(ValueBox vb) {
    Ref r = (Ref) vb.getValue();
    if (r instanceof StaticFieldRef) {
        SootFieldRef fieldRef = ((StaticFieldRef) r).getFieldRef();
        // addPackage(fieldRef.declaringClass().getJavaPackageName());
        String className = fieldRef.declaringClass().toString();
        String packageName = fieldRef.declaringClass().getJavaPackageName();
        String classPackageName = packageName;
        if (className.lastIndexOf('.') > 0) {
            // 0 doesnt make sense
            classPackageName = className.substring(0, className.lastIndexOf('.'));
        }
        if (!packageName.equals(classPackageName))
            throw new DecompilationException("Unable to retrieve package name for identifier. Please report to developer.");
        addToImportList(className);
        vb.setValue(new DStaticFieldRef(fieldRef, getMethod().getDeclaringClass().getName()));
    } else if (r instanceof ArrayRef) {
        ArrayRef ar = (ArrayRef) r;
        javafy(ar.getBaseBox());
        javafy(ar.getIndexBox());
    } else if (r instanceof InstanceFieldRef) {
        InstanceFieldRef ifr = (InstanceFieldRef) r;
        javafy(ifr.getBaseBox());
        vb.setValue(new DInstanceFieldRef(ifr.getBase(), ifr.getFieldRef(), thisLocals));
    } else if (r instanceof ThisRef) {
        ThisRef tr = (ThisRef) r;
        vb.setValue(new DThisRef((RefType) tr.getType()));
    }
}
Also used : ArrayRef(soot.jimple.ArrayRef) DThisRef(soot.dava.internal.javaRep.DThisRef) CaughtExceptionRef(soot.jimple.CaughtExceptionRef) DThisRef(soot.dava.internal.javaRep.DThisRef) ArrayRef(soot.jimple.ArrayRef) SootMethodRef(soot.SootMethodRef) SootFieldRef(soot.SootFieldRef) DStaticFieldRef(soot.dava.internal.javaRep.DStaticFieldRef) ThisRef(soot.jimple.ThisRef) DInstanceFieldRef(soot.dava.internal.javaRep.DInstanceFieldRef) Ref(soot.jimple.Ref) InstanceFieldRef(soot.jimple.InstanceFieldRef) ParameterRef(soot.jimple.ParameterRef) StaticFieldRef(soot.jimple.StaticFieldRef) DThisRef(soot.dava.internal.javaRep.DThisRef) ThisRef(soot.jimple.ThisRef) DInstanceFieldRef(soot.dava.internal.javaRep.DInstanceFieldRef) DInstanceFieldRef(soot.dava.internal.javaRep.DInstanceFieldRef) InstanceFieldRef(soot.jimple.InstanceFieldRef) DStaticFieldRef(soot.dava.internal.javaRep.DStaticFieldRef) SootFieldRef(soot.SootFieldRef) DStaticFieldRef(soot.dava.internal.javaRep.DStaticFieldRef) StaticFieldRef(soot.jimple.StaticFieldRef)

Aggregations

SootFieldRef (soot.SootFieldRef)1 SootMethodRef (soot.SootMethodRef)1 DInstanceFieldRef (soot.dava.internal.javaRep.DInstanceFieldRef)1 DStaticFieldRef (soot.dava.internal.javaRep.DStaticFieldRef)1 DThisRef (soot.dava.internal.javaRep.DThisRef)1 ArrayRef (soot.jimple.ArrayRef)1 CaughtExceptionRef (soot.jimple.CaughtExceptionRef)1 InstanceFieldRef (soot.jimple.InstanceFieldRef)1 ParameterRef (soot.jimple.ParameterRef)1 Ref (soot.jimple.Ref)1 StaticFieldRef (soot.jimple.StaticFieldRef)1 ThisRef (soot.jimple.ThisRef)1