/** * This method returns the superclass, or null if no superclass has been specified for this class. * * WARNING: interfaces are subclasses of the java.lang.Object class! Returns the superclass of this class. (see * hasSuperclass()) */ public SootClass getSuperclassUnsafe() { checkLevel(HIERARCHY); return superClass; }
/** * This method returns the outer class, or null if no outer class has been specified for this class. */ public SootClass getOuterClassUnsafe() { checkLevel(HIERARCHY); return outerClass; }
/** * Sets the superclass of this class. Note that passing a null will cause the class to have no superclass. */ public void setSuperclass(SootClass c) { checkLevel(HIERARCHY); superClass = c; }
public SootClass getOuterClass() { checkLevel(HIERARCHY); if (outerClass == null) { throw new RuntimeException("no outer class"); } else { return outerClass; } }
/** Returns true if parent is, or is a superclass of, possibleChild. */ public boolean isClassSuperclassOfIncluding(SootClass parent, SootClass possibleChild) { parent.checkLevel(SootClass.HIERARCHY); possibleChild.checkLevel(SootClass.HIERARCHY); return getSubclassesOfIncluding(parent).contains(possibleChild); }
/** Returns true if parent is a direct superinterface of possibleChild. */ public boolean isInterfaceDirectSuperinterfaceOf(SootClass parent, SootClass possibleChild) { parent.checkLevel(SootClass.HIERARCHY); possibleChild.checkLevel(SootClass.HIERARCHY); return getDirectSuperinterfacesOf(possibleChild).contains(parent); }
/** Returns true if child is a subinterface of possibleParent. */ public boolean isInterfaceSubinterfaceOf(SootClass child, SootClass possibleParent) { child.checkLevel(SootClass.HIERARCHY); possibleParent.checkLevel(SootClass.HIERARCHY); return getSubinterfacesOf(possibleParent).contains(child); }
/** Returns true if parent is a superinterface of possibleChild. */ public boolean isInterfaceSuperinterfaceOf(SootClass parent, SootClass possibleChild) { parent.checkLevel(SootClass.HIERARCHY); possibleChild.checkLevel(SootClass.HIERARCHY); return getSuperinterfacesOf(possibleChild).contains(parent); }
/** * Return true if class child is a subclass of class parent, neither of them being allowed to be interfaces. If we don't * know any of the classes, we always return false */ public boolean isSubclass(SootClass child, SootClass parent) { child.checkLevel(SootClass.HIERARCHY); parent.checkLevel(SootClass.HIERARCHY); Interval parentInterval = classToInterval.get(parent); Interval childInterval = classToInterval.get(child); return parentInterval != null && childInterval != null && parentInterval.isSubrange(childInterval); }
/** * Returns the method of this class with the given subsignature. If no method with the given subsignature can be found, * null is returned. */ public SootMethod getMethodUnsafe(NumberedString subsignature) { checkLevel(SIGNATURES); if (subSigToMethods == null) { return null; } SootMethod ret = subSigToMethods.get(subsignature); return ret; }
/** * Returns the number of methods in this class. */ public int getMethodCount() { checkLevel(SIGNATURES); if (subSigToMethods == null) { return 0; } return subSigToMethods.nonNullSize(); }
/** * Returns a backed Chain of the interfaces that are directly implemented by this class. (see getInterfaceCount()) */ @SuppressWarnings("unchecked") public Chain<SootClass> getInterfaces() { checkLevel(HIERARCHY); return interfaces == null ? EmptyChain.v() : interfaces; }
/** Returns a list of direct subclasses of c, including c. */ public List<SootClass> getDirectSubclassesOfIncluding(SootClass c) { c.checkLevel(SootClass.HIERARCHY); if (c.isInterface()) { throw new RuntimeException("class needed!"); } checkState(); List<SootClass> l = new ArrayList<SootClass>(); l.addAll(classToDirSubclasses.get(c)); l.add(c); return Collections.unmodifiableList(l); }
/** Returns a list of subclasses of c, including itself. */ public List<SootClass> getSubclassesOfIncluding(SootClass c) { c.checkLevel(SootClass.HIERARCHY); if (c.isInterface()) { throw new RuntimeException("class needed!"); } List<SootClass> l = new ArrayList<SootClass>(); l.addAll(getSubclassesOf(c)); l.add(c); return Collections.unmodifiableList(l); }
/** Returns a list of direct subclasses of c, excluding c. */ public List<SootClass> getDirectSubclassesOf(SootClass c) { c.checkLevel(SootClass.HIERARCHY); if (c.isInterface()) { throw new RuntimeException("class needed!"); } checkState(); return Collections.unmodifiableList(classToDirSubclasses.get(c)); }
/** Returns a list of direct subinterfaces of c. */ public List<SootClass> getDirectSubinterfacesOf(SootClass c) { c.checkLevel(SootClass.HIERARCHY); if (!c.isInterface()) { throw new RuntimeException("interface needed!"); } checkState(); return interfaceToDirSubinterfaces.get(c); }
/** * Returns a list of possible targets for the given method and set of receiver types. */ public List<SootMethod> resolveAbstractDispatch(List<SootClass> classes, SootMethod m) { m.getDeclaringClass().checkLevel(SootClass.HIERARCHY); Set<SootMethod> s = new ArraySet<SootMethod>(); for (SootClass sootClass : classes) { s.addAll(resolveAbstractDispatch(sootClass, m)); } return Collections.unmodifiableList(new ArrayList<SootMethod>(s)); }
/** * Removes the given class from the list of interfaces which are directly implemented by this class. */ public void removeInterface(SootClass interfaceClass) { checkLevel(HIERARCHY); if (!implementsInterface(interfaceClass.getName())) { throw new RuntimeException("no such interface: " + interfaceClass.getName()); } interfaces.remove(interfaceClass); }
public SootMethod getMethodUnsafe(String subsignature) { checkLevel(SIGNATURES); NumberedString numberedString = Scene.v().getSubSigNumberer().find(subsignature); return numberedString == null ? null : getMethodUnsafe(numberedString); }
/** * Does this class declare a method with the given subsignature? */ public boolean declaresMethod(String subsignature) { checkLevel(SIGNATURES); NumberedString numberedString = Scene.v().getSubSigNumberer().find(subsignature); return numberedString == null ? false : declaresMethod(numberedString); }