final public void caseRefType(RefType t) { SootClass cl = t.getSootClass(); List<AllocNode> list; if ((list = class2allocs.get(cl)) == null) { list = new LinkedList<AllocNode>(); class2allocs.put(cl, list); } list.add(alloc); }
public void setOpType(Type t) { opType = t; if (opType instanceof NullType || opType instanceof ArrayType || opType instanceof RefType) { opType = RefType.v(); } }
private void updateType(Type type) { if (type instanceof RefType) { RefType rt = (RefType) type; if (!rt.getSootClass().isLibraryClass() && oldToNewClassNames.containsKey(rt.getClassName())) { rt.setSootClass(newNameToClass.get(oldToNewClassNames.get(rt.getClassName()))); rt.setClassName(oldToNewClassNames.get(rt.getClassName())); } } else if (type instanceof ArrayType) { ArrayType at = (ArrayType) type; if (at.baseType instanceof RefType) { RefType rt = (RefType) at.baseType; if (!rt.getSootClass().isLibraryClass() && oldToNewClassNames.containsKey(rt.getClassName())) { rt.setSootClass(newNameToClass.get(oldToNewClassNames.get(rt.getClassName()))); } } } }
public static AnySubType v(RefType base) { if (base.getAnySubType() == null) { synchronized (base) { if (base.getAnySubType() == null) { base.setAnySubType(new AnySubType(base)); } } } return base.getAnySubType(); }
protected boolean isTypeLoaded(Type tp) { if (tp instanceof RefType) { RefType rt = (RefType) tp; if (rt.hasSootClass()) { return isClassLoaded(rt.getSootClass()); } } return false; }
/** * Returns the RefType with the given className. */ public void addRefType(RefType type) { nameToClass.put(type.getClassName(), type); }
return; if (leftType instanceof RefType && ((RefType) leftType).getClassName().equals("java.lang.Object")) { return; if (leftType.equals(RefType.v("java.io.Serializable")) || leftType.equals(RefType.v("java.lang.Cloneable")) || leftType.equals(RefType.v("java.lang.Object"))) { return; SootClass leftClass = ((RefType) leftType).getSootClass(); SootClass rightClass = ((RefType) rightType).getSootClass(); if (leftClass.isPhantom() || rightClass.isPhantom()) { return;
protected ReferenceVariable staticFieldImpl(String className, String fieldName) { SootClass c = RefType.v(className).getSootClass(); SootField f = c.getFieldByName(fieldName); return pag.makeGlobalVarNode(f, f.getType()); }
protected boolean isExceptionCaught(Body b, Stmt s, RefType throwType) { if (hierarchy == null) { hierarchy = new FastHierarchy(); } Iterator it = b.getTraps().iterator(); while (it.hasNext()) { Trap trap = (Trap) it.next(); if (trap.getException().getType().equals(throwType) || hierarchy.isSubclass(throwType.getSootClass(), (trap.getException().getType()).getSootClass())) { if (isThrowInStmtRange(b, (Stmt) trap.getBeginUnit(), (Stmt) trap.getEndUnit(), s)) { return true; } } } return false; }
public Wrapper() { PrimType[] tmp = { BooleanType.v(), ByteType.v(), CharType.v(), DoubleType.v(), FloatType.v(), IntType.v(), LongType.v(), ShortType.v() }; wrapperTypes = new HashMap<>(); valueOf = new HashMap<>(); primitiveValue = new HashMap<>(); for (PrimType primType : tmp) { RefType wrapperType = primType.boxedType(); String cn = wrapperType.getClassName(); wrapperTypes.put(wrapperType, primType); String valueOfMethodSignature = cn + " valueOf(" + primType.toString() + ")"; SootMethod valueOfMethod = wrapperType.getSootClass().getMethod(valueOfMethodSignature); valueOf.put(primType, valueOfMethod); String primitiveValueMethodSignature = primType.toString() + " " + primType.toString() + "Value()"; SootMethod primitiveValueMethod = wrapperType.getSootClass().getMethod(primitiveValueMethodSignature); primitiveValue.put(wrapperType, primitiveValueMethod); } wrapperTypes = Collections.unmodifiableMap(wrapperTypes); valueOf = Collections.unmodifiableMap(valueOf); primitiveValue = Collections.unmodifiableMap(primitiveValue); }
final SootClass objectClass = Scene.v().getObjectType().getSootClass(); boolean exclusionBaseHasNoHierarchy = !(exclusionBase.getSootClass().hasSuperclass() || // exclusionBase.getSootClass() == objectClass); boolean isExcluded = exclusionBaseHasNoHierarchy && exclusionBase.equals(newBase); isExcluded |= !exclusionBaseHasNoHierarchy && (hierarchy.canStoreType(newBase, exclusionBase) || hierarchy.canStoreType(exclusionBase, newBase)); + "] where " + exclusionBase.toString() + " is excluded."); RefType incumbentBase = ((AnySubType) incumbent).getBase(); if (newBaseHasNoHierarchy) { if (!incumbentBase.equals(newBase)) { resultSet.add(incumbent);
if (exclusion.getBase().equals(catcher)) { return false; RefType thrownBase = ((AnySubType) thrownType).getBase(); if (catcherHasNoHierarchy) { if (thrownBase.equals(catcher) || thrownBase.getClassName().equals("java.lang.Throwable")) { return true;
@Override public int compare(T o1, T o2) { RefType t1 = baseType(o1); RefType t2 = baseType(o2); if (t1.equals(t2)) { // There should never be both AnySubType(t) and // t in a ThrowableSet, but if it happens, put // AnySubType(t) first: if (o1 instanceof AnySubType) { if (o2 instanceof AnySubType) { return 0; } else { return -1; } } else if (o2 instanceof AnySubType) { return 1; } else { return 0; } } else { return t1.toString().compareTo(t2.toString()); } }
public boolean equivTo(Object o) { if (o instanceof AbstractNewExpr) { AbstractNewExpr ae = (AbstractNewExpr) o; return type.equals(ae.type); } return false; }
public soot.RefType soot_RefType() { if (instance_soot_RefType == null) { synchronized (this) { if (instance_soot_RefType == null) instance_soot_RefType = new soot.RefType(g); } } return instance_soot_RefType; } protected void release_soot_RefType() {
/** Returns a hash code for this object, consistent with structural equality. */ public int equivHashCode() { return type.hashCode(); }
public boolean containsClass(String className) { RefType type = nameToClass.get(className); if (type == null) { return false; } if (!type.hasSootClass()) { return false; } SootClass c = type.getSootClass(); return c.isInScene(); }
public RefType getOrAddRefType(RefType tp) { RefType existing = nameToClass.get(tp.getClassName()); if (existing != null) { return existing; } nameToClass.put(tp.getClassName(), tp); return tp; }
if (other.equals(UnknownType.v()) || this.equals(other)) { return this; SootClass javalangObject = cm.getObjectType().getSootClass();
if (catcherHasNoHierarchy && exclusionBase.equals(catcher)) { return new Pair(ThrowableSet.Manager.v().EMPTY, this); if (base.equals(catcher)) { caughtIncluded = addExceptionToSet(inclusion, caughtIncluded); } else { if (base.getClassName().equals("java.lang.Throwable")) { caughtIncluded = addExceptionToSet(catcher, caughtIncluded);