Class CAstAbstractModuleLoader

java.lang.Object
com.ibm.wala.cast.loader.CAstAbstractLoader
com.ibm.wala.cast.loader.CAstAbstractModuleLoader
All Implemented Interfaces:
IClassLoader, SummaryClassShellLoader
Direct Known Subclasses:
JavaScriptLoader

public abstract class CAstAbstractModuleLoader extends CAstAbstractLoader implements SummaryClassShellLoader
abstract class loader that performs CAst and IR generation for relevant entities in a list of Modules. Subclasses provide the CAst / IR translators appropriate for the language.
  • Constructor Details

  • Method Details

    • getTranslatorToCAst

      protected abstract TranslatorToCAst getTranslatorToCAst(CAst ast, ModuleEntry M, List<Module> modules) throws IOException
      create the appropriate CAst translator for the language and source module
      Parameters:
      modules - all modules in the analysis
      Throws:
      IOException
    • shouldTranslate

      protected abstract boolean shouldTranslate(CAstEntity entity)
      should IR be generated for entity?
    • initTranslator

      protected abstract TranslatorToIR initTranslator(Set<Pair<CAstEntity, ModuleEntry>> topLevelEntities)
      create the appropriate IR translator for the language
      Parameters:
      topLevelEntities - the set of all modules being translated
    • getLocalFile

      protected File getLocalFile(SourceModule M) throws IOException
      Throws:
      IOException
    • finishTranslation

      protected void finishTranslation()
      subclasses should override to perform actions after CAst and IR have been generated. by default, do nothing
    • init

      public void init(List<Module> modules)
      Description copied from interface: IClassLoader
      Initialize internal data structures.
      Specified by:
      init in interface IClassLoader
    • defineSummaryClassShell

      public IClass defineSummaryClassShell(TypeName name, TypeName superName)
      Register a "shell" IClass for a summary-modeled type, so that source classes loaded by this loader can resolve it as a superclass at definition time.

      A CAst class resolves its superclass through this loader's own type map (CAstAbstractLoader.lookupClass(TypeName), CAstAbstractModuleLoader.CoreClass.getSuperclass()), which is loader-local and does not consult the IClassHierarchy or parent loaders. When a framework base type is modeled only by an XML method summary, the corresponding class is materialized into the BypassSyntheticClassLoader only after the class hierarchy is built, which is too late, and in the wrong loader, for a source subclass to pick up the inheritance edge. Registering a shell here, before the hierarchy is built, closes that gap (see #1957).

      Idempotent: if a class is already registered under name, it is returned unchanged.

      Specified by:
      defineSummaryClassShell in interface SummaryClassShellLoader
      Parameters:
      name - the type to register a shell for
      superName - the shell's superclass, or null for this loader's language root type
      Returns:
      the registered (or pre-existing) class