Hi all, I found a possible bug in Monticello scripts. Let me try to describe the issue:


Steps to reproduce

  1. In Monticello Browser, create a new package named #Foo
  2. In the System Browser, create a new class named #FooClass in the system category #Foo
  3. On its class side, add a method named #bar - just declare it.
  4. In Monticello Browser, edit the preambleOfRemoval for our #Foo Package and set it to:
    FooClass bar
  5. Save a version of our #Foo package
  6. Still in Monticello Browser, unload the foo package via context menu.

Expected behavior
The package is unloaded without any errors. If Foo class >> bar has a real implementation, it will have run when the package is removed.

Actual behavior
In MCRemovalPreambleDefinition >> #evaluate: UndefinedObject does not understand #bar.

Reason
In MCPackageLoader >> #analyze, the MCDependencySorter for removals does not return the removal preamble definition as the last item, but the class definition of FooClass. This happens somewhere in #addExternalProvisions:, because FooClass depends on Object and thus is moved to the end (?).

Questions
Am I right that this is a bug? I think we really want to execute the removal preamble *before* unloading any code definitions?
How could one solve this issue? Is it necessary to treat preambles/postambles separated so that they can't be messed up by dependencies? Or would know an easier way?
I'm not familiar at all with this domain, so if we want a fast solution, maybe someone others could have a look at it. Otherwise, I'd be happy to hear your opinions.

Best,
Christoph