Exception in Iceberg when removing selectors from anonymous classes

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Exception in Iceberg when removing selectors from anonymous classes

Steven Costiou-2

Hi,

i downloaded yesterday the latest Pharo 7 and in a playground if you do:

class := Object newAnonymousSubclass. (OK)
class package. "a RPackage(_UnpackagedPackage)" (OK)
class compile: 'test ^nil'. (OK)
(class >> #test) package. "nil" (Surprising but no problem with any pharo version since yesterday)
class removeSelector: #test. (Exception, see below)

An exception is raised in IceSystemEventListener class because the method package is nil:


handlePackagesChange: packages
    IceRepository registry do: [ :repository | | changed |
        changed := packages anySatisfy: [ :each |
            repository notifyPackageModified: each name ]. "(each is nil here)"
        changed ifTrue: [
            Iceberg announcer announce: (IceRepositoryModified for: repository) ]]

So to fix it, the package needs to be correctly set for each method compiled in an anonymous class, but  should anonymous subclasses really raise events when adding/modifying/removing methods?

Steven.