Interface IClassHierarchy

All Superinterfaces:
Iterable<IClass>
All Known Implementing Classes:
ClassHierarchy, CrossLanguageClassHierarchy

public interface IClassHierarchy extends Iterable<IClass>
General interface for a type hierarchy
  • Method Details Link icon

    • getFactory Link icon

      ClassLoaderFactory getFactory()
    • getScope Link icon

      AnalysisScope getScope()
    • getLoaders Link icon

      IClassLoader[] getLoaders()
    • getLoader Link icon

      IClassLoader getLoader(ClassLoaderReference loaderRef)
    • addClass Link icon

      boolean addClass(IClass klass)
      Returns:
      true if the add succeeded; false if it failed for some reason
      Throws:
      IllegalArgumentException - if klass is null
    • getNumberOfClasses Link icon

      int getNumberOfClasses()
      Returns:
      The number of classes present in the class hierarchy.
    • isRootClass Link icon

      boolean isRootClass(IClass c)
    • getRootClass Link icon

      IClass getRootClass()
    • getNumber Link icon

      int getNumber(IClass c)
    • getUnresolvedClasses Link icon

      Set<TypeReference> getUnresolvedClasses()
    • getPossibleTargets Link icon

      Set<IMethod> getPossibleTargets(MethodReference ref)
      Find the possible targets of a call to a method reference
      Parameters:
      ref - method reference
      Returns:
      the set of IMethods that this call can resolve to.
      Throws:
      IllegalArgumentException - if ref is null
    • getPossibleTargets Link icon

      Set<IMethod> getPossibleTargets(IClass receiverClass, MethodReference ref)
      Find the possible targets of a call to a method reference where the receiver is of a certain type
      Parameters:
      receiverClass - the class of the receiver
      ref - method reference
      Returns:
      the set of IMethods that this call can resolve to.
    • resolveMethod Link icon

      IMethod resolveMethod(MethodReference m)
      Return the unique receiver of an invocation of method on an object of type m.getDeclaredClass(). Note that for Java, m.getDeclaredClass() must represent a class, not an interface. This method does not work for finding inherited methods in interfaces.
      Returns:
      IMethod, or null if no appropriate receiver is found.
      Throws:
      IllegalArgumentException - if m is null
    • resolveField Link icon

      IField resolveField(FieldReference f)
      Returns:
      the canonical IField that represents a given field , or null if none found
      Throws:
      IllegalArgumentException - if f is null
    • resolveField Link icon

      IField resolveField(IClass klass, FieldReference f)
      Returns:
      the canonical IField that represents a given field , or null if none found
      Throws:
      IllegalArgumentException - if f is null
      IllegalArgumentException - if klass is null
    • resolveMethod Link icon

      IMethod resolveMethod(IClass receiverClass, Selector selector)
      Return the unique target of an invocation of method on an object of type receiverClass
      Parameters:
      receiverClass - type of receiver. Note that for Java, receiverClass must represent a class, not an interface. This method does not work for finding inherited methods in interfaces.
      selector - method signature
      Returns:
      Method resolved method abstraction
      Throws:
      IllegalArgumentException - if receiverClass is null
    • lookupClass Link icon

      IClass lookupClass(TypeReference A)
      Load a class using one of the loaders specified for this class hierarchy
      Returns:
      null if can't find the class.
      Throws:
      IllegalArgumentException - if A is null
    • isInterface Link icon

      boolean isInterface(TypeReference type)
    • getLeastCommonSuperclass Link icon

      IClass getLeastCommonSuperclass(IClass A, IClass B)
    • getLeastCommonSuperclass Link icon

      TypeReference getLeastCommonSuperclass(TypeReference A, TypeReference B)
    • isSubclassOf Link icon

      boolean isSubclassOf(IClass c, IClass T)
      Is c a subclass of T?
      Throws:
      IllegalArgumentException - if c is null
    • implementsInterface Link icon

      boolean implementsInterface(IClass c, IClass i)
      Does c implement i?
      Returns:
      true iff i is an interface and c is a class that implements i, or c is an interface that extends i.
    • computeSubClasses Link icon

      Collection<IClass> computeSubClasses(TypeReference type)
      Return set of all subclasses of type in the Class Hierarchy
    • getJavaLangErrorTypes Link icon

      Collection<TypeReference> getJavaLangErrorTypes()
      Solely for optimization; return a Collection<TypeReference> representing the subclasses of Error

      kind of ugly. a better scheme?

    • getJavaLangRuntimeExceptionTypes Link icon

      Collection<TypeReference> getJavaLangRuntimeExceptionTypes()
      Solely for optimization; return a Collection<TypeReference> representing the subclasses of RuntimeException

      kind of ugly. a better scheme?

    • getImplementors Link icon

      Set<IClass> getImplementors(TypeReference type)
      Parameters:
      type - an interface
      Returns:
      Set of IClass that represent implementors of the interface
    • getNumberOfImmediateSubclasses Link icon

      int getNumberOfImmediateSubclasses(IClass klass)
      Returns:
      the number of classes that immediately extend klass.
    • getImmediateSubclasses Link icon

      Collection<IClass> getImmediateSubclasses(IClass klass)
      Returns:
      the classes that immediately extend klass.
    • isAssignableFrom Link icon

      boolean isAssignableFrom(IClass c1, IClass c2)
      Does an expression c1 x := c2 y typecheck?

      i.e. is c2 a subtype of c1?

      Throws:
      IllegalArgumentException - if c1 is null
      IllegalArgumentException - if c2 is null
    • clearCaches Link icon

      void clearCaches()
      Clear internal caches that may be invalidated by addition of new classes, e.g., a cache of the results of getPossibleTargets(MethodReference).