Class ClassLoaderImpl

java.lang.Object
com.ibm.wala.classLoader.ClassLoaderImpl
All Implemented Interfaces:
IClassLoader
Direct Known Subclasses:
JavaSourceLoaderImpl, WDexClassLoaderImpl

public class ClassLoaderImpl extends Object implements IClassLoader
A class loader that reads class definitions from a set of Modules.
  • Field Details Link icon

    • DEBUG_LEVEL Link icon

      public static final int DEBUG_LEVEL
      See Also:
    • loadedClasses Link icon

      protected final Map<TypeName,IClass> loadedClasses
      A mapping from class name (TypeName) to IClass
    • cha Link icon

      protected final IClassHierarchy cha
      Governing class hierarchy
  • Constructor Details Link icon

  • Method Details Link icon

    • loadAllSources Link icon

      protected void loadAllSources(Set<ModuleEntry> sourceModules)
      Set up mapping from type name to Module Entry
    • init Link icon

      public void init(List<Module> modules) throws IOException
      Initialize internal data structures
      Specified by:
      init in interface IClassLoader
      Throws:
      IllegalArgumentException - if modules is null
      IOException
    • getReference Link icon

      public ClassLoaderReference getReference()
      Description copied from interface: IClassLoader
      Return the ClassLoaderReference for this class loader.
      Specified by:
      getReference in interface IClassLoader
      Returns:
      ClassLoaderReference
    • iterateAllClasses Link icon

      public Iterator<IClass> iterateAllClasses()
      Specified by:
      iterateAllClasses in interface IClassLoader
      Returns:
      an Iterator of all classes loaded by this loader
    • lookupClass Link icon

      public IClass lookupClass(TypeName className)
      Description copied from interface: IClassLoader
      Find and return the IClass defined by this class loader that corresponds to the given class name.
      Specified by:
      lookupClass in interface IClassLoader
      Parameters:
      className - name of the class
      Returns:
      the IClass defined by this class loader that corresponds to the given class name, or null if not found.
    • getParent Link icon

      public IClassLoader getParent()
      Method getParent.
      Specified by:
      getParent in interface IClassLoader
      Returns:
      the parent IClassLoader, if any, or null
    • getName Link icon

      public Atom getName()
      Specified by:
      getName in interface IClassLoader
      Returns:
      the unique name that identifies this class loader.
    • getLanguage Link icon

      public Language getLanguage()
      Specified by:
      getLanguage in interface IClassLoader
      Returns:
      the unique name that identifies the programming language from which this class loader loads code.
    • toString Link icon

      public String toString()
      Overrides:
      toString in class Object
    • getNumberOfClasses Link icon

      public int getNumberOfClasses()
      Specified by:
      getNumberOfClasses in interface IClassLoader
      Returns:
      the number of classes in scope to be loaded by this loader
    • getNumberOfMethods Link icon

      public int getNumberOfMethods()
      Specified by:
      getNumberOfMethods in interface IClassLoader
    • getSourceFileName Link icon

      public String getSourceFileName(IClass klass)
      Specified by:
      getSourceFileName in interface IClassLoader
      Parameters:
      klass - the class for which information is desired.
      Returns:
      name of source file corresponding to the class, or null if not available
    • getSource Link icon

      public Reader getSource(IMethod method, int offset)
      Specified by:
      getSource in interface IClassLoader
      Parameters:
      method - The method for which information is desired
      offset - an offset into the bytecode of the given method.
      Returns:
      input stream representing the source file for a given bytecode index of a given method, or null if not available
    • getSourceFileName Link icon

      public String getSourceFileName(IMethod method, int offset)
      Specified by:
      getSourceFileName in interface IClassLoader
      Parameters:
      method - The method for which information is desired
      offset - an offset into the bytecode of the given method.
      Returns:
      name of the source file corresponding to the given offset in the given method. Note that this api allows a single method to arise from multiple source files, which is deliberate as it can happen in some languages.
    • getSource Link icon

      public Reader getSource(IClass klass)
      Specified by:
      getSource in interface IClassLoader
      Returns:
      input stream representing the source file for a class, or null if not available
    • removeAll Link icon

      public void removeAll(Collection<IClass> toRemove)
      Description copied from interface: IClassLoader
      blow away references to any classes in the set
      Specified by:
      removeAll in interface IClassLoader
      Parameters:
      toRemove - Collection<IClass>
    • getInstructionFactory Link icon

      public SSAInstructionFactory getInstructionFactory()
      Specified by:
      getInstructionFactory in interface IClassLoader