please include function myInnerClasses. static abstract class DynModule { S name, toolTip; PersistableThrowable _error; Map> mechLists; Map _persistenceInfo; transient O _host; transient Map timers = newWeakHashMap(); // all kinds of resources actually; value is closer helper transient Set _resources = synchroHashSet(); transient Lock lock; // set by stem transient bool persistOnChangedField = true; transient int changeCount; transient L onChange; transient bool verboseTimers; transient ReliableSingleThread rstUpdate; transient Set componentFieldsToKeep; transient Map transientGeneralMap = synchroHashMap(); *() { dm_initErrorHandling(); setMainDesktopPane((JDesktopPane) getCreatorOpt('desktop)); } bool isVisible() { ret isTrue(getOpt(_host, 'visible)); } S moduleName() { ret name; } void setModuleName(S name) { S oldName = this.name; if (!eq(name, oldName)) { this.name = name; possiblyInternalFrameTitle(vis(), name); vmBus_send('moduleNameChange, this, oldName, name); } } void setModuleToolTip(S toolTip) { this.toolTip = toolTip; } JComponent vis() { ret (JComponent) getOpt(_host, 'vis); } A ownResource(A a) { if (a != null) _resources.add(a); ret a; } A ownTimer(A timer) { if (timer instanceof AutoCloseable) ownResource((AutoCloseable) timer); ownTimer(timer, f cancelTimerOrInterruptThread); ret timer; } void ownTimer(O timer, O closerHelper) { timers.put(timer, closerHelper); } void singleTimer(java.util.Timer timer) { stopAllTimers(); ownTimer(timer); } void stopAllTimers() { for (AutoCloseable resource : getAndClearList(_resources)) { if (verboseTimers) print("Releasing resource: " + resource); pcall { resource.close(); } } for (O timer, closerHelper : getAndClearMap(timers)) { if (verboseTimers) print("Stopping timer: " + closerHelper + " / " + timer); pcallF(closerHelper, timer); } } void cleanMeUp_dynModule { stopAllTimers(); } void persistMe { { lock lock; ++changeCount; } pcallFAll(onChange); callOpt(_host, '_change); updateMe(); } void _change { persistMe(); } void change { persistMe(); } void updateMe { lock lock; update(); } void changeAndUpdate { _change(); updateMe(); } bool setField(S name, O value) { // XXX lock lock; if (eq(get(this, name), value)) false; set(this, name, value); if (persistOnChangedField && !isFalse(mapGet(_persistenceInfo, name))) _change(); true; } A setFieldAndReturn(S name, A value) { setField(name, value); ret value; } bool setFields(O... params) { bool change = false; for (int i = 0; i < l(params); i += 2) if (setField((S) params[i], params[i+1])) change = true; ret change; } void start {} void revisualize { call(creator(), 'revisualizeModule, _host); } AutoCloseable enter() { please include function dm_currentModule. ret tempSetThreadLocal(dm_currentModule_value, new WeakReference(this)); } AutoCloseable enterAndLock() { ret combineAutoCloseables(enter(), tempLock(lock)); } bool setError(Throwable e) { setField(_error := persistableThrowable(e)); true; } void clearError { setField(_error := null); } void onChange(Runnable r) { lock lock; if (onChange == null) onChange = synchroList(); addIfNotThere(onChange, r); } void update() {} void unvisualize() { zeroAllFieldsOfTypeExcept(this, Component, componentFieldsToKeep); } L menuItems() { null; } void enhanceFrame(Container f) { internalFramePopupMenuFromActions_threaded(f, menuItems()); } // assume this is called in start(), so no locking ReliableSingleThread rstUpdate() { if (rstUpdate == null) rstUpdate = dm_rst(this, r updateMe); ret rstUpdate; } A withUpdate(A a) { rstUpdate().trigger(); ret a; } DynModule module() { this; } } static void _registerTimer(java.util.Timer timer) { _registerTimer_original(timer); dm_currentModule().ownTimer(timer); }