deleting a pragma leaves ObsoleteClasses in the PragmaCache
Bug description Deleting a class which has method(s) with Pragmas leads to having obsolete classes in the PragmaCache.
To Reproduce Steps to reproduce the behavior:
- Go to Launcher and create a new P14 image
- Create a new class and add a method with a pragma
- Delete this class
- Now you have an obsolete class in the PragmaCache
Pragma pragmaCache at: #aPragmaForDemo
additionally, I wonder that, each time, I save this method with the pragma, we have a new entry in the PragmaCache. I think, this is a Bug, too. This is the reason why in the screen are 2 entries - I saved that method twice.
Expected behavior 1.) Deleting a class should remove the Pragmas of the associated methods from the PragmaCache. 2.) Saving a method a second time should only add it if not yet there (I am not sure about this, perhaps it is by intent?)
Version information:
- OS: ;MacOS
- Pharo Version: tested with P11 and P14
Additional context I found this when working with Tealight: https://github.com/astares/Tealight/issues/6
Tx for the report.
We already filter for #isInstalled. We can add to check if the class is Obsolete, e.g. in pragmaNamed:
^ (pragmas select: [ :each | each method isInstalled and: [ each methodClass isObsolete not ]]) asArray
The Obsolete classes in the cache will get cleaned up eventually (when the class gets GCed)