Closed alamqadem closed 8 months ago
I've verified and now a ModelListener on an Interface builds and the listener is triggered correctly.
I've marked it as draft because I'm getting runtime errors (in the red error balloon in the corner) when building.
Somewhere it seems to still be calling the old constructor, I looked in the generator of modellisteners
, but the calls to the constructors look fine to me.
Here is the stacktrace that I get.
Caught exception from the listener com.mbeddr.mpsutil.modellisteners.runtime.GlobalListener@5f296354. Will continue.
java.lang.NoSuchMethodError:
'void com.mbeddr.mpsutil.modellisteners.runtime.ChildListener.<init>(
org.jetbrains.mps.openapi.language.SConcept,
org.jetbrains.mps.openapi.language.SContainmentLink)'
at org.iets3.core.expr.toplevel.listeners.ModelListenersDescriptor$1
.<init>(ModelListenersDescriptor.java:28)
at org.iets3.core.expr.toplevel.listeners.ModelListenersDescriptor
.getListeners(ModelListenersDescriptor.java:28)
at com.mbeddr.mpsutil.modellisteners.runtime.GlobalListener
.updateListeners(GlobalListener.java:113)
at com.mbeddr.mpsutil.modellisteners.runtime.GlobalListener
.onUnloaded(GlobalListener.java:82)
at jetbrains.mps.classloading.ClassLoadingBroadCaster
.onUnload(ClassLoadingBroadCaster.java:97)
at jetbrains.mps.classloading.ClassLoaderManager
.lambda$unloadModules$5(ClassLoaderManager.java:458)
at jetbrains.mps.classloading.ClassLoaderManager
.runTransaction(ClassLoaderManager.java:323)
at jetbrains.mps.classloading.ClassLoaderManager
.unloadModules(ClassLoaderManager.java:447)
at jetbrains.mps.classloading.ClassLoaderManager
.doReloadModules(ClassLoaderManager.java:551)
at jetbrains.mps.classloading.ClassLoaderManager
.reloadModules(ClassLoaderManager.java:492)
at jetbrains.mps.classloading.ClassLoaderManager
.reloadModules(ClassLoaderManager.java:580)
at jetbrains.mps.make.facets.ReloadClasses_Facet$Target_reloadClasses$1
.lambda$execute$0(ReloadClasses_Facet.java:76)
at jetbrains.mps.smodel.ActionDispatcher.dispatch(ActionDispatcher.java:99)
at jetbrains.mps.smodel.ActionDispatcher.lambda$wrap$0(ActionDispatcher.java:136)
at jetbrains.mps.smodel.LockRunnable.run(LockRunnable.java:60)
at com.intellij.openapi.application.impl.ApplicationImpl
.runReadAction(ApplicationImpl.java:839)
at jetbrains.mps.smodel.WorkbenchModelAccess
.runWriteAction(WorkbenchModelAccess.java:100)
at jetbrains.mps.smodel.ModelAccessBase.runWriteAction(ModelAccessBase.java:66)
at jetbrains.mps.make.facets.ReloadClasses_Facet$Target_reloadClasses$1
.execute(ReloadClasses_Facet.java:76)
at jetbrains.mps.internal.make.runtime.script.Script
.lambda$executeTargets$0(Script.java:309)
at jetbrains.mps.ide.make.WorkbenchMakeService$Controller
.runJobWithMonitor(WorkbenchMakeService.java:314)
at jetbrains.mps.internal.make.runtime.script.Script
.executeTargets(Script.java:254)
at jetbrains.mps.internal.make.runtime.script.Script
.execute(Script.java:232)
at jetbrains.mps.make.service.CoreMakeTask.lambda$doRun$0(CoreMakeTask.java:101)
at jetbrains.mps.make.dependencies.MakeSequence.iterate(MakeSequence.java:54)
at jetbrains.mps.make.service.CoreMakeTask.doRun(CoreMakeTask.java:75)
at jetbrains.mps.ide.make.MakeTask$WorkbenchMakeTask.doRun(MakeTask.java:148)
at jetbrains.mps.make.service.CoreMakeTask.run(CoreMakeTask.java:54)
at jetbrains.mps.ide.make.MakeTask$2.run(MakeTask.java:68)
at java.base/java.lang.Thread.run(Thread.java:829)
I think that's fine. While unloading it already calls the newly compiled methods, that's why you get the errors. When you restart MPS everything works.
Don't forget to update the changelog and the checking rule. Small refactoring possibility: It would also be nice to not log to System.out
in the demo language but use the log
or message
statement.
I made the changes that you suggested, if you can have a look.
I'm still getting the error if I open a project using modellisteners
, even if I open it in the same instance alongside this mps-extensions
branch, restarting mps doesn't solve it.
To me it's still not clear what is going on 🤔 .
Edit: I would like to add that I see the error also when it loads the classes
Did you rebuild the listener aspect in the second project and also reload the project so that the listeners get unregistered and registered again?
This pull request adds the possibility to create model listeners on
InterfaceConcept
s.