RPackage does not update extension methods to removed classes

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

RPackage does not update extension methods to removed classes

Mariano Martinez Peck
Hi Stef. I notice that RPackage does not update the extension methods of removed classes. It is easy to reproduce in Pharo 2.0 by doing:

 (RPackageOrganizer  default packageNamed: 'FreeType') allDefinedExtensionMethods   (this fails because FreeType used to have a extension method in TTCFont which was removed)

Or step by step:

1) Create package PackageX.
2) Create package PackageY and ClassY.
3) Create in ClassY a extension method with category *PackageX. If you now browse the instVar "classExtensionSelectors" of PackageX you will see ClassY.
4) Remove ClassY
5) notice that 'classExtensionSelectors' from PackageX still references ClassY. In fact, if you ask its extension methods you will have a KeyNotFound #ClassY in Smalltalk globals ;)

So...I guess this is a bug.  If true, I open an issue.

Reply | Threaded
Open this post in threaded view
|

Re: RPackage does not update extension methods to removed classes

Mariano Martinez Peck


On Sat, Aug 4, 2012 at 2:34 PM, Mariano Martinez Peck <[hidden email]> wrote:
Hi Stef. I notice that RPackage does not update the extension methods of removed classes. It is easy to reproduce in Pharo 2.0 by doing:

 (RPackageOrganizer  default packageNamed: 'FreeType') allDefinedExtensionMethods   (this fails because FreeType used to have a extension method in TTCFont which was removed)

Or step by step:

1) Create package PackageX.
2) Create package PackageY and ClassY.
3) Create in ClassY a extension method with category *PackageX. If you now browse the instVar "classExtensionSelectors" of PackageX you will see ClassY.
4) Remove ClassY
5) notice that 'classExtensionSelectors' from PackageX still references ClassY. In fact, if you ask its extension methods you will have a KeyNotFound #ClassY in Smalltalk globals ;)

So...I guess this is a bug.  If true, I open an issue.


and to fix the already existing ones we can do:

| extensions |
RPackage allInstances do: [:aPackage |
extensions := (aPackage  instVarNamed: 'classExtensionSelectors').
extensions keysDo: [:aClassName |
(Smalltalk globals includesKey: aClassName) ifFalse:  [extensions removeKey: aClassName].
]. 
extensions := (aPackage  instVarNamed: 'metaclassExtensionSelectors').
extensions keysDo: [:aClassName |
(Smalltalk globals includesKey: aClassName) ifFalse:  [extensions removeKey: aClassName].
]. 
]

 



--
Mariano
http://marianopeck.wordpress.com

Reply | Threaded
Open this post in threaded view
|

Re: RPackage does not update extension methods to removed classes

Mariano Martinez Peck
grrrr and the same happens for methods that are removed....they are not removed from the RPackage :(

On Sat, Aug 4, 2012 at 2:41 PM, Mariano Martinez Peck <[hidden email]> wrote:


On Sat, Aug 4, 2012 at 2:34 PM, Mariano Martinez Peck <[hidden email]> wrote:
Hi Stef. I notice that RPackage does not update the extension methods of removed classes. It is easy to reproduce in Pharo 2.0 by doing:

 (RPackageOrganizer  default packageNamed: 'FreeType') allDefinedExtensionMethods   (this fails because FreeType used to have a extension method in TTCFont which was removed)

Or step by step:

1) Create package PackageX.
2) Create package PackageY and ClassY.
3) Create in ClassY a extension method with category *PackageX. If you now browse the instVar "classExtensionSelectors" of PackageX you will see ClassY.
4) Remove ClassY
5) notice that 'classExtensionSelectors' from PackageX still references ClassY. In fact, if you ask its extension methods you will have a KeyNotFound #ClassY in Smalltalk globals ;)

So...I guess this is a bug.  If true, I open an issue.


and to fix the already existing ones we can do:

| extensions |
RPackage allInstances do: [:aPackage |
extensions := (aPackage  instVarNamed: 'classExtensionSelectors').
extensions keysDo: [:aClassName |
(Smalltalk globals includesKey: aClassName) ifFalse:  [extensions removeKey: aClassName].
]. 
extensions := (aPackage  instVarNamed: 'metaclassExtensionSelectors').
extensions keysDo: [:aClassName |
(Smalltalk globals includesKey: aClassName) ifFalse:  [extensions removeKey: aClassName].
]. 
]



--
Mariano
http://marianopeck.wordpress.com




--
Mariano
http://marianopeck.wordpress.com

Reply | Threaded
Open this post in threaded view
|

Re: RPackage does not update extension methods to removed classes

Guillermo Polito
In reply to this post by Mariano Martinez Peck


On Sat, Aug 4, 2012 at 2:34 PM, Mariano Martinez Peck <[hidden email]> wrote:
Hi Stef. I notice that RPackage does not update the extension methods of removed classes. It is easy to reproduce in Pharo 2.0 by doing:

 (RPackageOrganizer  default packageNamed: 'FreeType') allDefinedExtensionMethods   (this fails because FreeType used to have a extension method in TTCFont which was removed)

Or step by step:

1) Create package PackageX.
2) Create package PackageY and ClassY.
3) Create in ClassY a extension method with category *PackageX. If you now browse the instVar "classExtensionSelectors" of PackageX you will see ClassY.
4) Remove ClassY
5) notice that 'classExtensionSelectors' from PackageX still references ClassY. In fact, if you ask its extension methods you will have a KeyNotFound #ClassY in Smalltalk globals ;) 

So...I guess this is a bug.  If true, I open an issue.

It is, and those steps can be translated to a test! :D 


Reply | Threaded
Open this post in threaded view
|

Re: RPackage does not update extension methods to removed classes

Guillermo Polito
In reply to this post by Mariano Martinez Peck


On Sat, Aug 4, 2012 at 2:41 PM, Mariano Martinez Peck <[hidden email]> wrote:


On Sat, Aug 4, 2012 at 2:34 PM, Mariano Martinez Peck <[hidden email]> wrote:
Hi Stef. I notice that RPackage does not update the extension methods of removed classes. It is easy to reproduce in Pharo 2.0 by doing:

 (RPackageOrganizer  default packageNamed: 'FreeType') allDefinedExtensionMethods   (this fails because FreeType used to have a extension method in TTCFont which was removed)

Or step by step:

1) Create package PackageX.
2) Create package PackageY and ClassY.
3) Create in ClassY a extension method with category *PackageX. If you now browse the instVar "classExtensionSelectors" of PackageX you will see ClassY.
4) Remove ClassY
5) notice that 'classExtensionSelectors' from PackageX still references ClassY. In fact, if you ask its extension methods you will have a KeyNotFound #ClassY in Smalltalk globals ;)

So...I guess this is a bug.  If true, I open an issue.


and to fix the already existing ones we can do:

| extensions |
RPackage allInstances do: [:aPackage |
extensions := (aPackage  instVarNamed: 'classExtensionSelectors').
extensions keysDo: [:aClassName |
(Smalltalk globals includesKey: aClassName) ifFalse:  [extensions removeKey: aClassName].
]. 
extensions := (aPackage  instVarNamed: 'metaclassExtensionSelectors').
extensions keysDo: [:aClassName |
(Smalltalk globals includesKey: aClassName) ifFalse:  [extensions removeKey: aClassName].
]. 
]


Easier:

2) RPackageOrganizer initialize.
 



--
Mariano
http://marianopeck.wordpress.com


Reply | Threaded
Open this post in threaded view
|

Re: RPackage does not update extension methods to removed classes

Guillermo Polito
Ok, I found the bug, I'm killing it.

On Sun, Aug 5, 2012 at 1:07 PM, Guillermo Polito <[hidden email]> wrote:


On Sat, Aug 4, 2012 at 2:41 PM, Mariano Martinez Peck <[hidden email]> wrote:


On Sat, Aug 4, 2012 at 2:34 PM, Mariano Martinez Peck <[hidden email]> wrote:
Hi Stef. I notice that RPackage does not update the extension methods of removed classes. It is easy to reproduce in Pharo 2.0 by doing:

 (RPackageOrganizer  default packageNamed: 'FreeType') allDefinedExtensionMethods   (this fails because FreeType used to have a extension method in TTCFont which was removed)

Or step by step:

1) Create package PackageX.
2) Create package PackageY and ClassY.
3) Create in ClassY a extension method with category *PackageX. If you now browse the instVar "classExtensionSelectors" of PackageX you will see ClassY.
4) Remove ClassY
5) notice that 'classExtensionSelectors' from PackageX still references ClassY. In fact, if you ask its extension methods you will have a KeyNotFound #ClassY in Smalltalk globals ;)

So...I guess this is a bug.  If true, I open an issue.


and to fix the already existing ones we can do:

| extensions |
RPackage allInstances do: [:aPackage |
extensions := (aPackage  instVarNamed: 'classExtensionSelectors').
extensions keysDo: [:aClassName |
(Smalltalk globals includesKey: aClassName) ifFalse:  [extensions removeKey: aClassName].
]. 
extensions := (aPackage  instVarNamed: 'metaclassExtensionSelectors').
extensions keysDo: [:aClassName |
(Smalltalk globals includesKey: aClassName) ifFalse:  [extensions removeKey: aClassName].
]. 
]


Easier:

2) RPackageOrganizer initialize.


Reply | Threaded
Open this post in threaded view
|

Re: RPackage does not update extension methods to removed classes

Mariano Martinez Peck
In reply to this post by Guillermo Polito


On Sun, Aug 5, 2012 at 1:07 PM, Guillermo Polito <[hidden email]> wrote:


On Sat, Aug 4, 2012 at 2:41 PM, Mariano Martinez Peck <[hidden email]> wrote:


On Sat, Aug 4, 2012 at 2:34 PM, Mariano Martinez Peck <[hidden email]> wrote:
Hi Stef. I notice that RPackage does not update the extension methods of removed classes. It is easy to reproduce in Pharo 2.0 by doing:

 (RPackageOrganizer  default packageNamed: 'FreeType') allDefinedExtensionMethods   (this fails because FreeType used to have a extension method in TTCFont which was removed)

Or step by step:

1) Create package PackageX.
2) Create package PackageY and ClassY.
3) Create in ClassY a extension method with category *PackageX. If you now browse the instVar "classExtensionSelectors" of PackageX you will see ClassY.
4) Remove ClassY
5) notice that 'classExtensionSelectors' from PackageX still references ClassY. In fact, if you ask its extension methods you will have a KeyNotFound #ClassY in Smalltalk globals ;)

So...I guess this is a bug.  If true, I open an issue.


and to fix the already existing ones we can do:

| extensions |
RPackage allInstances do: [:aPackage |
extensions := (aPackage  instVarNamed: 'classExtensionSelectors').
extensions keysDo: [:aClassName |
(Smalltalk globals includesKey: aClassName) ifFalse:  [extensions removeKey: aClassName].
]. 
extensions := (aPackage  instVarNamed: 'metaclassExtensionSelectors').
extensions keysDo: [:aClassName |
(Smalltalk globals includesKey: aClassName) ifFalse:  [extensions removeKey: aClassName].
]. 
]


Easier:

2) RPackageOrganizer initialize.
 

Indeed, I saw that later. That only helps to fix the existing ones but it does not solve the problem. 

 




--
Mariano
http://marianopeck.wordpress.com

Reply | Threaded
Open this post in threaded view
|

Re: RPackage does not update extension methods to removed classes

Guillermo Polito
http://code.google.com/p/pharo/issues/detail?id=6526 here you are :)

On Sun, Aug 5, 2012 at 1:39 PM, Mariano Martinez Peck <[hidden email]> wrote:


On Sun, Aug 5, 2012 at 1:07 PM, Guillermo Polito <[hidden email]> wrote:


On Sat, Aug 4, 2012 at 2:41 PM, Mariano Martinez Peck <[hidden email]> wrote:


On Sat, Aug 4, 2012 at 2:34 PM, Mariano Martinez Peck <[hidden email]> wrote:
Hi Stef. I notice that RPackage does not update the extension methods of removed classes. It is easy to reproduce in Pharo 2.0 by doing:

 (RPackageOrganizer  default packageNamed: 'FreeType') allDefinedExtensionMethods   (this fails because FreeType used to have a extension method in TTCFont which was removed)

Or step by step:

1) Create package PackageX.
2) Create package PackageY and ClassY.
3) Create in ClassY a extension method with category *PackageX. If you now browse the instVar "classExtensionSelectors" of PackageX you will see ClassY.
4) Remove ClassY
5) notice that 'classExtensionSelectors' from PackageX still references ClassY. In fact, if you ask its extension methods you will have a KeyNotFound #ClassY in Smalltalk globals ;)

So...I guess this is a bug.  If true, I open an issue.


and to fix the already existing ones we can do:

| extensions |
RPackage allInstances do: [:aPackage |
extensions := (aPackage  instVarNamed: 'classExtensionSelectors').
extensions keysDo: [:aClassName |
(Smalltalk globals includesKey: aClassName) ifFalse:  [extensions removeKey: aClassName].
]. 
extensions := (aPackage  instVarNamed: 'metaclassExtensionSelectors').
extensions keysDo: [:aClassName |
(Smalltalk globals includesKey: aClassName) ifFalse:  [extensions removeKey: aClassName].
]. 
]


Easier:

2) RPackageOrganizer initialize.
 

Indeed, I saw that later. That only helps to fix the existing ones but it does not solve the problem. 



--
Mariano
http://marianopeck.wordpress.com