/** * Get whole tree of interfaces on {@code Scene} for class/interface. * * @param sc * class or interface to get all its interfaces * @return all interfaces on {@code Scene} for class or interface */ public static List<SootClass> getAllInterfacesOf(SootClass sc) { Hierarchy hierarchy = Scene.v().getActiveHierarchy(); Stream<SootClass> superClassInterfaces = sc.isInterface() ? Stream.empty() : hierarchy.getSuperclassesOf(sc).stream().map(HierarchyUtils::getAllInterfacesOf).flatMap(Collection::stream); Stream<SootClass> directInterfaces = Stream.concat(sc.getInterfaces().stream(), sc.getInterfaces().stream().map(HierarchyUtils::getAllInterfacesOf).flatMap(Collection::stream)); return Stream.concat(superClassInterfaces, directInterfaces).collect(toList()); }
private Set<SootClass> getParentsOfIncluding(Collection<SootClass> classes) { final Set<SootClass> parents = new HashSet<>(classes); for (SootClass clazz : classes) { // add implementing interfaces parents.addAll(clazz.getInterfaces()); // add extending class if any if (!clazz.isInterface() && clazz.hasSuperclass()) { parents.add(clazz.getSuperclass()); } // and superclasses (superinterfaces) of passed applicationClass parents.addAll(clazz.isInterface() ? Scene.v().getActiveHierarchy().getSuperinterfacesOfIncluding(clazz) : Scene.v().getActiveHierarchy().getSuperclassesOfIncluding(clazz)); } return parents; }
if (c.isInterface()) { List<SootClass> l2 = interfaceToDirSuperinterfaces.get(c); for (SootClass i : c.getInterfaces()) { if (c.resolvingLevel() < SootClass.HIERARCHY) { continue; for (SootClass i : c.getInterfaces()) { if (c.resolvingLevel() < SootClass.HIERARCHY) { continue;
for (Iterator<SootClass> i = sClass.getInterfaces().iterator(); i.hasNext();) { TypeNode parent = hierarchy.typeNode(RefType.v((i.next()).getName())); plist.add(parent);
private static Collection<AncestryTreeNode> buildAncestryTree(RefType root) { if (root.getSootClass().isPhantom()) { return Collections.emptyList(); } LinkedList<AncestryTreeNode> leafs = new LinkedList<AncestryTreeNode>(); leafs.add(new AncestryTreeNode(null, root)); LinkedList<AncestryTreeNode> r = new LinkedList<AncestryTreeNode>(); final RefType objectType = RefType.v("java.lang.Object"); while (!leafs.isEmpty()) { AncestryTreeNode node = leafs.remove(); if (TypeResolver.typesEqual(node.type, objectType)) { r.add(node); } else { SootClass sc = node.type.getSootClass(); for (SootClass i : sc.getInterfaces()) { leafs.add(new AncestryTreeNode(node, (i).getType())); } // The superclass of all interfaces is Object // -- try to discard phantom interfaces. if ((!sc.isInterface() || sc.getInterfaceCount() == 0) && !sc.isPhantom()) { leafs.add(new AncestryTreeNode(node, sc.getSuperclass().getType())); } } } return r; }
public void reResolveHierarchy(SootClass sc, int level) { // Bring superclasses to hierarchy SootClass superClass = sc.getSuperclassUnsafe(); if (superClass != null) { addToResolveWorklist(superClass, level); } SootClass outerClass = sc.getOuterClassUnsafe(); if (outerClass != null) { addToResolveWorklist(outerClass, level); } for (SootClass iface : sc.getInterfaces()) { addToResolveWorklist(iface, level); } }
private List<SootClass> getExceptionSpec(SootClass intrface, NumberedString sig) { SootMethod sm = intrface.getMethodUnsafe(sig); if (sm != null) { return sm.getExceptions(); } List<SootClass> result = null; SootClass obj = Scene.v().getSootClass("java.lang.Object"); sm = obj.getMethodUnsafe(sig); if (sm.getExceptionsUnsafe() == null) { return Collections.emptyList(); } if (sm != null) { result = new Vector<SootClass>(sm.getExceptions()); } for (SootClass suprintr : intrface.getInterfaces()) { List<SootClass> other = getExceptionSpec(suprintr, sig); if (other != null) { if (result == null) { result = other; } else { result.retainAll(other); } } } return result; }
for (SootClass interf : sc.getInterfaces()) { if (canStoreClassClassic(interf, parent)) { return true;
private List<SootClass> getParentsOfIncluding(SootClass applicationClass) { // result contains of interfaces that implements passed applicationClass final List<SootClass> result = HierarchyUtils.getAllInterfacesOf(applicationClass); // add implementing interfaces result.addAll(applicationClass.getInterfaces()); // add extending class if any if (!applicationClass.isInterface() && applicationClass.hasSuperclass()) { result.add(applicationClass.getSuperclass()); } // and superclasses (superinterfaces) of passed applicationClass result.addAll( applicationClass.isInterface() ? Scene.v().getActiveHierarchy().getSuperinterfacesOfIncluding(applicationClass) : Scene.v().getActiveHierarchy().getSuperclassesOfIncluding(applicationClass)); return result; }
final Queue<SootClass> queue = new ArrayDeque<>(selectedClass.getInterfaces()); while (!queue.isEmpty()) { final SootClass iface = queue.poll(); queue.addAll(iface.getInterfaces());
Iterator<SootClass> interfaceIt = cl.getInterfaces().iterator();
Iterator<SootClass> interfaceIt = cl.getInterfaces().iterator(); while (interfaceIt.hasNext()) { String interfacePackage = ((SootClass) interfaceIt.next()).toString(); Iterator<SootClass> interfaceIt = cl.getInterfaces().iterator();
Iterator<SootClass> implementedInterfaces = sc.getInterfaces().iterator(); int i = 0; while (implementedInterfaces.hasNext()) {
Iterator interfaceIt = c.getInterfaces().iterator(); while (interfaceIt.hasNext()) { SootClass interfaceClass = (SootClass) interfaceIt.next();
for (Iterator<SootClass> i = sClass.getInterfaces().iterator(); i.hasNext();) { TypeNode parent = hierarchy.typeNode(ArrayType.v(RefType.v((i.next()).getName()), type.numDimensions)); plist.add(parent);
= xmlClassNode.addChild("interfaces", "", new String[] { "count" }, new String[] { cl.getInterfaceCount() + "" }); Iterator<SootClass> interfaceIt = cl.getInterfaces().iterator(); if (interfaceIt.hasNext()) { while (interfaceIt.hasNext()) {
if (!c.getInterfaces().isEmpty()) { interfaces = new ArrayList<String>(); for (SootClass ifc : c.getInterfaces()) { interfaces.add(SootToDexUtils.getDexTypeDescriptor(ifc.getType()));
queue.addAll(cl.getInterfaces()); while (true) { SootClass iface = queue.poll(); return checkStatic(ifaceField); queue.addAll(iface.getInterfaces());
for (final SootClass supercl : cl.getInterfaces()) { if (cl.isInterface()) { interfaceToSubinterfaces.put(supercl, cl);
Iterator<SootClass> interfaceIt = sootClass.getInterfaces().iterator();