Class TempModule2

  • All Implemented Interfaces:
    EditableSModule, SModule

    public class TempModule2
    extends AbstractModule
    Alternative temporary module, not a subject to classloading (not a ReloadableModule). TL;DR We've got global repositories, tests need temporary models living in a repository (editor doesn't tolerate detached models). Each test creates own module and effectively triggers re-calculation of dependency edges for other modules in the repository which slows down test execution. Check https://youtrack.jetbrains.com/issue/MPS-27846

    Classloading reacts to any ReloadableModule added to a global repository (ClassLoaderManager.myWatchableCondition which is propagated down to ModuleUpdater) and spends noticeable time in ModuleUpdater#updateAdded -> updateAllEdges. TempModule is ReloadableModule, and there's no other temp module. TransformationTests (like NodesTestCase, EditorTestCase) use modeling facilities only and don't need to load classes for test nodes, however I can't tell for sure other clients of TempModule do not, therefore a change in TempModule would be dangerous. Another alternative is to use ReloadableModule.canLoadClasses() ()} and corresponding setting in TempModuleOptions, but there's no clear contract for willLoad(), besides, it might get changed with respect to improved module classloading story. Yet another alternative is to use TransientModuleProvider and TransientModelsModule (which is not ReloadableModule as well). Though this seems the most appropriate way forward, it's not viable right now. First, due to single provider instance, second, due to greater changes in the tests.

    Since:
    2018.2
    • Method Detail

      • collectMandatoryFacetTypes

        protected void collectMandatoryFacetTypes​(Set<String> types)
        Description copied from class: AbstractModule
        For the time being, MPS enforces certain facets for modules (e.g. Java facet is essential for classloading mechanism). As we move forward with facets story, we likely respect actual facets for the module (e.g. would force Java facet on module creation only) Need to ensure classloading could deal with modules without Java facet, then can drop these mandatory facets altogether
        Overrides:
        collectMandatoryFacetTypes in class AbstractModule
      • isPackaged

        public boolean isPackaged()
        Description copied from interface: SModule
        The module has been imported as a compiled library, not sources. Implies read only.
        Specified by:
        isPackaged in interface SModule
        Overrides:
        isPackaged in class AbstractModule