Interface SummaryClassShellLoader
- All Superinterfaces:
IClassLoader
- All Known Implementing Classes:
BypassSyntheticClassLoader, CAstAbstractModuleLoader, JavaScriptLoader
A capability, implemented by class loaders that can introduce "shell" classes for types modeled
only by a summary, so that source classes subclassing such a type can resolve their base at
definition time rather than falling back to the language root.
This exists because a class resolves its superclass through its own loader; a summary-modeled
framework base materialized late (and in the BypassSyntheticClassLoader) is invisible to
a source subclass at class-hierarchy-build time. Loaders that own a mutable set of classes (the
BypassSyntheticClassLoader and the CAst module loaders) can instead register a shell
eagerly, before the hierarchy is built. See #1957.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptiondefineSummaryClassShell(TypeName name, TypeName superName) Register a shellIClassfor a summary-modeled type, so that classes loaded by this loader can resolve it as a superclass.default 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.Methods inherited from interface IClassLoader
getInstructionFactory, getLanguage, getName, getNumberOfClasses, getNumberOfMethods, getParent, getReference, getSource, getSource, getSourceFileName, getSourceFileName, init, iterateAllClasses, lookupClass, removeAllModifier and TypeMethodDescriptiongetName()intintReturn the ClassLoaderReference for this class loader.getSourceFileName(IClass klass) getSourceFileName(IMethod method, int offset) voidInitialize internal data structures.lookupClass(TypeName className) Find and return the IClass defined by this class loader that corresponds to the given class name.voidremoveAll(Collection<IClass> toRemove) blow away references to any classes in the set
-
Method Details
-
defineSummaryClassShell
Register a shellIClassfor a summary-modeled type, so that classes loaded by this loader can resolve it as a superclass.Idempotent: if a class is already registered under
name, it is returned unchanged.- 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
-
defineSummaryClassShell
default IClass defineSummaryClassShell(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. when resolving an inherited method on a subclass) finds them. The method bodies are still bound late by the usual bypass mechanism; only the declarations need to exist on the shell.The default implementation ignores
methodsand delegates todefineSummaryClassShell(TypeName, TypeName); implementations whose shells can carry methods (such as theBypassSyntheticClassLoader) override this.- Parameters:
name- the type to register a shell forsuperName- the shell's superclass, ornullfor this loader's language root typemethods- summaries for the methods the shell should declare- Returns:
- the registered (or pre-existing) class
-