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.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassclassclass -
Field Summary
Fields inherited from class CAstAbstractLoader
cha, parent, typesModifier and TypeFieldDescriptionprotected final IClassHierarchyprotected final IClassLoadertypes loaded by this -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondefineSummaryClassShell(TypeName name, TypeName superName) Register a "shell"IClassfor a summary-modeled type, so that source classes loaded by this loader can resolve it as a superclass at definition time.protected voidsubclasses should override to perform actions after CAst and IR have been generated.protected Fileprotected abstract TranslatorToCAstgetTranslatorToCAst(CAst ast, ModuleEntry M, List<Module> modules) create the appropriate CAst translator for the language and source modulevoidInitialize internal data structures.protected abstract TranslatorToIRinitTranslator(Set<Pair<CAstEntity, ModuleEntry>> topLevelEntities) create the appropriate IR translator for the languageprotected abstract booleanshouldTranslate(CAstEntity entity) should IR be generated for entity?Methods inherited from class CAstAbstractLoader
addMessage, addMessages, clearMessages, getMessages, getModulesWithParseErrors, getModulesWithWarnings, getName, getNumberOfClasses, getNumberOfMethods, getParent, getSource, getSource, getSourceFileName, getSourceFileName, iterateAllClasses, lookupClass, lookupClass, removeAllModifier and TypeMethodDescriptionvoidaddMessage(ModuleEntry module, Warning message) voidaddMessages(ModuleEntry module, Set<Warning> message) voidgetName()intintgetSourceFileName(IClass klass) getSourceFileName(IMethod method, int bcOffset) lookupClass(TypeName className) Find and return the IClass defined by this class loader that corresponds to the given class name.lookupClass(String className, IClassHierarchy cha) voidremoveAll(Collection<IClass> toRemove) blow away references to any classes in the setMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface IClassLoader
getInstructionFactory, getLanguage, getReferenceModifier and TypeMethodDescriptionReturn the ClassLoaderReference for this class loader.Methods inherited from interface SummaryClassShellLoader
defineSummaryClassShellModifier and TypeMethodDescriptiondefault IClassdefineSummaryClassShell(TypeName name, TypeName superName, Collection<MethodSummary> methods) Register a shellIClassthat also exposes the given method summaries as its own declared methods, so that a walk of the shell (e.g.
-
Constructor Details
-
CAstAbstractModuleLoader
-
CAstAbstractModuleLoader
-
-
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
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
- Throws:
IOException
-
finishTranslation
protected void finishTranslation()subclasses should override to perform actions after CAst and IR have been generated. by default, do nothing -
init
Description copied from interface:IClassLoaderInitialize internal data structures.- Specified by:
initin interfaceIClassLoader
-
defineSummaryClassShell
Register a "shell"IClassfor 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 theIClassHierarchyor parent loaders. When a framework base type is modeled only by an XML method summary, the corresponding class is materialized into theBypassSyntheticClassLoaderonly 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:
defineSummaryClassShellin interfaceSummaryClassShellLoader- Parameters:
name- the type to register a shell forsuperName- the shell's superclass, ornullfor this loader's language root type- Returns:
- the registered (or pre-existing) class
-