Interface IClassLoader

    • Method Detail

      • lookupClass

        IClass lookupClass​(TypeName className)
        Find and return the IClass defined by this class loader that corresponds to the given class name.
        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.
      • getReference

        ClassLoaderReference getReference()
        Return the ClassLoaderReference for this class loader.
        Returns:
        ClassLoaderReference
      • iterateAllClasses

        Iterator<IClass> iterateAllClasses()
        Returns:
        an Iterator of all classes loaded by this loader
      • getNumberOfClasses

        int getNumberOfClasses()
        Returns:
        the number of classes in scope to be loaded by this loader
      • getName

        Atom getName()
        Returns:
        the unique name that identifies this class loader.
      • getLanguage

        Language getLanguage()
        Returns:
        the unique name that identifies the programming language from which this class loader loads code.
      • getNumberOfMethods

        int getNumberOfMethods()
      • getSourceFileName

        String getSourceFileName​(IMethod method,
                                 int offset)
        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

        Reader getSource​(IMethod method,
                         int offset)
        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

        String getSourceFileName​(IClass klass)
                          throws NoSuchElementException
        Parameters:
        klass - the class for which information is desired.
        Returns:
        name of source file corresponding to the class, or null if not available
        Throws:
        NoSuchElementException - if this class was generated from more than one source file The assumption that a class is generated from a single source file is java specific, and will change in the future. In place of this API, use the version that takes a method and an offset, since that is now the granularity at which source file information will be recorded. SJF .. we should think about this deprecation. postponing deprecation for now.
      • getSource

        Reader getSource​(IClass klass)
                  throws NoSuchElementException
        Returns:
        input stream representing the source file for a class, or null if not available
        Throws:
        NoSuchElementException - if this class was generated from more than one source file The assumption that a class is generated from a single source file is java specific, and will change in the future. In place of this API, use the version that takes a method and an offset, since that is now the granularity at which source file information will be recorded. SJF .. we should think about this deprecation. postponing deprecation for now.
      • getParent

        IClassLoader getParent()
        Returns:
        the parent IClassLoader, if any, or null
      • removeAll

        void removeAll​(Collection<IClass> toRemove)
        blow away references to any classes in the set
        Parameters:
        toRemove - Collection