private static RefType baseType(RefLikeType o) { if (o instanceof AnySubType) { return ((AnySubType) o).getBase(); } else { return (RefType) o; // ClassCastException if o is not a RefType. } }
public static AnySubType v(RefType base) { if (base.getAnySubType() == null) { synchronized (base) { if (base.getAnySubType() == null) { base.setAnySubType(new AnySubType(base)); } } } return base.getAnySubType(); }
RefType newBase = e.getBase(); boolean newBaseHasNoHierarchy = hasNoHierarchy(newBase); RefType exclusionBase = excludedType.getBase(); boolean exclusionBaseHasNoHierarchy = !(exclusionBase.getSootClass().hasSuperclass() || // exclusionBase.getSootClass() == objectClass); throw new AlreadyHasExclusionsException("ThrowableSet.add(" + e.toString() + ") to the set [ " + this.toString() + "] where " + exclusionBase.toString() + " is excluded."); RefType incumbentBase = ((AnySubType) incumbent).getBase(); if (newBaseHasNoHierarchy) { if (!incumbentBase.equals(newBase)) {
private FullObjectSet(RefType declaredType) { Type type = AnySubType.v(declaredType); types = Collections.singleton(type); }
RefType exclusionBase = exclusion.getBase(); if (h.canStoreType(catcher, exclusionBase)) { RefType base = ((AnySubType) inclusion).getBase(); if (h.canStoreType(base, catcher)) { = addExceptionToSet(inclusion, uncaughtIncluded); uncaughtExcluded = addExceptionToSet(AnySubType.v(catcher), uncaughtExcluded); caughtIncluded = addExceptionToSet(AnySubType.v(catcher), caughtIncluded);
/** * A new local will be created and connected to {@link SparkLibraryHelper#node} of type {@link RefType}. For this new local * an allocation edge to {@link AnySubType} of its declared type will be added. */ @Override public void caseRefType(RefType t) { // var tmp; VarNode local = pag.makeLocalVarNode(new Object(), t, method); // new T(); AllocNode alloc = pag.makeAllocNode(new Object(), AnySubType.v(t), method); // tmp = new T(); pag.addAllocEdge(alloc, local); // x = tmp; pag.addEdge(local, node); }
buf.append(connector); buf.append('('); baseType = ((AnySubType) reflikeType).getBase(); } else { throw new RuntimeException("Unsupported type " + reflikeType.getClass().getName());
RefType exclusionBase = exclusion.getBase(); if (h.canStoreType(catcher, exclusionBase)) { RefType base = ((AnySubType) inclusion).getBase(); if (h.canStoreType(base, catcher)) { = addExceptionToSet(inclusion, uncaughtIncluded); uncaughtExcluded = addExceptionToSet(AnySubType.v(catcher), uncaughtExcluded); caughtIncluded = addExceptionToSet(AnySubType.v(catcher), caughtIncluded);
} else { FastHierarchy hierarchy = Scene.v().getOrMakeFastHierarchy(); RefType newBase = e.getBase(); RefType exclusionBase = ((AnySubType) i.next()).getBase(); if (hierarchy.canStoreType(newBase, exclusionBase) || hierarchy.canStoreType(exclusionBase, newBase)) { "ThrowableSet.add(" + e.toString() + ") to the set [ " + this.toString() + "] where " + exclusionBase.toString() RefType incumbentBase = ((AnySubType) incumbent).getBase();
final public Node caseDefaultClassLoader() { AllocNode a = pag.makeAllocNode(PointsToAnalysis.DEFAULT_CLASS_LOADER, AnySubType.v(rtClassLoader), null); VarNode v = pag.makeGlobalVarNode(PointsToAnalysis.DEFAULT_CLASS_LOADER_LOCAL, rtClassLoader); pag.addEdge(a, v); return v; }
public static AnySubType v( RefType base ) { if( base.getAnySubType() == null ) { base.setAnySubType( new AnySubType( base ) ); } return base.getAnySubType(); }
private Set<Type> resolveToClasses(Set<Type> rawTypes) { Set<Type> toReturn = new HashSet<Type>(); for (Type ty : rawTypes) { if (ty instanceof AnySubType) { AnySubType anySubType = (AnySubType) ty; RefType base = anySubType.getBase(); Set<SootClass> classRoots; if (base.getSootClass().isInterface()) { classRoots = fh.getAllImplementersOfInterface(base.getSootClass()); } else { classRoots = Collections.singleton(base.getSootClass()); } toReturn.addAll(getTransitiveSubClasses(classRoots)); } else if (ty instanceof ArrayType || ty instanceof RefType) { toReturn.add(ty); } } return toReturn; }
} else { FastHierarchy hierarchy = Scene.v().getOrMakeFastHierarchy(); RefType newBase = e.getBase(); RefType exclusionBase = ((AnySubType) i.next()).getBase(); if (hierarchy.canStoreType(newBase, exclusionBase) || hierarchy.canStoreType(exclusionBase, newBase)) { "ThrowableSet.add(" + e.toString() + ") to the set [ " + this.toString() + "] where " + exclusionBase.toString() RefType incumbentBase = ((AnySubType) incumbent).getBase();
CLASSLOADERCLASS = AnySubType.v(RefType.v("java.lang.ClassLoader")); PROCESSCLASS = AnySubType.v(RefType.v("java.lang.Process")); THREADCLASS = AnySubType.v(RefType.v("java.lang.Thread")); LEASTCLASS = AnySubType.v(RefType.v("java.lang.Object")); FILESYSTEMCLASS = AnySubType.v(RefType.v("java.io.FileSystem")); PRIVILEGEDACTIONEXCEPTION = AnySubType.v(RefType.v("java.security.PrivilegedActionException"));
public static AnySubType v( RefType base ) { if( base.getAnySubType() == null ) { base.setAnySubType( new AnySubType( base ) ); } return base.getAnySubType(); }
RefType incumbentBase = ((AnySubType) incumbentType).getBase(); if (hierarchy.canStoreType(newType, incumbentBase)) { RefType newBase = ((AnySubType) newType).getBase(); for (Iterator<RefLikeType> j = resultSet.iterator(); j.hasNext();) { RefLikeType incumbentType = j.next(); RefType incumbentBase = ((AnySubType) incumbentType).getBase(); if (newBase == incumbentBase) {
final public Node casePrivilegedActionException() { AllocNode a = pag.makeAllocNode(PointsToAnalysis.PRIVILEGED_ACTION_EXCEPTION, AnySubType.v(RefType.v("java.security.PrivilegedActionException")), null); VarNode v = pag.makeGlobalVarNode(PointsToAnalysis.PRIVILEGED_ACTION_EXCEPTION_LOCAL, RefType.v("java.security.PrivilegedActionException")); pag.addEdge(a, v); return v; }
throw new RuntimeException("Unhandled type " + parent); } else if (parent instanceof ArrayType) { Type base = ((AnySubType) child).getBase(); SootClass base = ((AnySubType) child).getBase().getSootClass(); SootClass parentClass = ((RefType) parent).getSootClass(); Deque<SootClass> worklist = new ArrayDeque<SootClass>();
AllocNode alloc = pag.makeAllocNode(new Object(), AnySubType.v((RefType) at.baseType), method);