RB Bug: removing "super send" method gives walkback

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

RB Bug: removing "super send" method gives walkback

Paul Hudson
Define a method that just calls "super <itself>", e.g.

Animal>>RBbug
    super RBBug

Refactoring can reasonably end up with this sort of method. Of
course it's not needed, so...

Now try to delete it using the RB (right click on the method
name, Refactorings, Remove)

The following walkback results:

11:33:09, 16 June 2002: 'RBClass does not understand
#whichClassIncludesSelector:'
RBClass(Object)>>doesNotUnderstand:
RemoveMethodRefactoring>>justSendsSuper:
[] in RemoveMethodRefactoring>>checkSuperMethods
[] in Array(Collection)>>reject:
[] in Array(SequenceableCollection)>>select:
Array(SequenceableCollection)>>from:to:keysAndValuesDo:
Array(SequenceableCollection)>>from:keysAndValuesDo:
Array(SequenceableCollection)>>keysAndValuesDo:
Array(SequenceableCollection)>>select:
Array(Collection)>>reject:
RemoveMethodRefactoring>>checkSuperMethods
[] in RemoveMethodRefactoring>>preconditions
RBCondition>>check
RBConjunctiveCondition>>check
RemoveMethodRefactoring(Refactoring)>>checkPreconditions
RemoveMethodRefactoring(Refactoring)>>primitiveExecute
RemoveMethodRefactoring(Refactoring)>>execute
[] in
RefactoringSmalltalkSystem>>safeRemoveMethod:from:inEnvironment
:
ExceptionHandlerSet(ExceptionHandlerAbstract)>>markAndTry
[] in ExceptionHandlerSet(ExceptionHandlerAbstract)>>try:
BlockClosure>>ifCurtailed:
BlockClosure>>ensure:
ExceptionHandlerSet(ExceptionHandlerAbstract)>>try:
BlockClosure>>onDo:
BlockClosure>>on:do:on:do:
RefactoringSmalltalkSystem>>handleRefactoringException:
RefactoringSmalltalkSystem>>safeRemoveMethod:from:inEnvironment
:
RefactoringSmalltalkSystem>>safeRemoveMethod:
[] in MethodBrowser>>safeRemoveMethod
MethodBrowser>>performRefactoring:
MethodBrowser>>safeRemoveMethod
Symbol>>forwardTo:
CommandDescription>>performAgainst:
[] in Command>>value
BlockClosure>>ifCurtailed:
BlockClosure>>ensure:
Command>>value
ShellView>>performCommand:
ClassBrowserShell(Shell)>>performCommand:
CommandQuery>>perform
DelegatingCommandPolicy(CommandPolicy)>>route:
[] in ListView(View)>>onCommand:
BlockClosure>>ifCurtailed:
BlockClosure>>ensure:
Cursor>>showWhile:
ListView(View)>>onCommand:
ListView(View)>>wmCommand:wParam:lParam:
ListView(View)>>dispatchMessage:wParam:lParam:
[] in InputState>>wndProc:message:wParam:lParam:cookie:
BlockClosure>>ifCurtailed:


Reply | Threaded
Open this post in threaded view
|

Re: RB Bug: removing "super send" method gives walkback

Joseph Pelrine-4
Paul Hudson wrote:

> Define a method that just calls "super <itself>", e.g.
>
> Animal>>RBbug
>         super RBBug
>
> Refactoring can reasonably end up with this sort of method. Of
> course it's not needed, so...
>
> Now try to delete it using the RB (right click on the method
> name, Refactorings, Remove)
>
> The following walkback results:
>
> 11:33:09, 16 June 2002: 'RBClass does not understand
> #whichClassIncludesSelector:'
> RBClass(Object)>>doesNotUnderstand:
> RemoveMethodRefactoring>>justSendsSuper:
> [] in RemoveMethodRefactoring>>checkSuperMethods
> [] in Array(Collection)>>reject:
> [] in Array(SequenceableCollection)>>select:
> Array(SequenceableCollection)>>from:to:keysAndValuesDo:
> Array(SequenceableCollection)>>from:keysAndValuesDo:
> Array(SequenceableCollection)>>keysAndValuesDo:
> Array(SequenceableCollection)>>select:
> Array(Collection)>>reject:
> RemoveMethodRefactoring>>checkSuperMethods
> [] in RemoveMethodRefactoring>>preconditions
> RBCondition>>check
> RBConjunctiveCondition>>check
> RemoveMethodRefactoring(Refactoring)>>checkPreconditions
> RemoveMethodRefactoring(Refactoring)>>primitiveExecute
> RemoveMethodRefactoring(Refactoring)>>execute
> [] in
> RefactoringSmalltalkSystem>>safeRemoveMethod:from:inEnvironment
> :
> ExceptionHandlerSet(ExceptionHandlerAbstract)>>markAndTry
> [] in ExceptionHandlerSet(ExceptionHandlerAbstract)>>try:
> BlockClosure>>ifCurtailed:
> BlockClosure>>ensure:
> ExceptionHandlerSet(ExceptionHandlerAbstract)>>try:
> BlockClosure>>onDo:
> BlockClosure>>on:do:on:do:
> RefactoringSmalltalkSystem>>handleRefactoringException:
> RefactoringSmalltalkSystem>>safeRemoveMethod:from:inEnvironment
> :
> RefactoringSmalltalkSystem>>safeRemoveMethod:
> [] in MethodBrowser>>safeRemoveMethod
> MethodBrowser>>performRefactoring:
> MethodBrowser>>safeRemoveMethod
> Symbol>>forwardTo:
> CommandDescription>>performAgainst:
> [] in Command>>value
> BlockClosure>>ifCurtailed:
> BlockClosure>>ensure:
> Command>>value
> ShellView>>performCommand:
> ClassBrowserShell(Shell)>>performCommand:
> CommandQuery>>perform
> DelegatingCommandPolicy(CommandPolicy)>>route:
> [] in ListView(View)>>onCommand:
> BlockClosure>>ifCurtailed:
> BlockClosure>>ensure:
> Cursor>>showWhile:
> ListView(View)>>onCommand:
> ListView(View)>>wmCommand:wParam:lParam:
> ListView(View)>>dispatchMessage:wParam:lParam:
> [] in InputState>>wndProc:message:wParam:lParam:cookie:
> BlockClosure>>ifCurtailed:

Paul

Thanks for catching this bug. It seems to be a problem with the RB, and
is also reproducible in VA (haven't checked any other dialects yet).

This fix seems to work:

!RBAbstractClass methodsFor!

whichClassIncludesSelector: aSelector
 ^self whoDefinesMethod: aSelector ! !
!RBAbstractClass categoriesFor: #whichClassIncludesSelector:!method
accessing!public! !

Maybe John Brant has fixed this, or has a better implementation.

Cheers

--
Joseph Pelrine [ | ]
MetaProg GmbH
Email: [hidden email]
Web:   http://www.metaprog.com

"If you don't live on the edge, you're taking up too much space" -
Doug Robinson


Reply | Threaded
Open this post in threaded view
|

Re: RB Bug: removing "super send" method gives walkback

John Brant
"Joseph Pelrine" <[hidden email]> wrote in
message news:[hidden email]...

>
> Paul Hudson wrote:
>
> > Define a method that just calls "super <itself>", e.g.
> >
> > Animal>>RBbug
> >         super RBBug
> >
> > Refactoring can reasonably end up with this sort of method. Of
> > course it's not needed, so...
> >
> > Now try to delete it using the RB (right click on the method
> > name, Refactorings, Remove)
> >
> > The following walkback results:
> >
> > 11:33:09, 16 June 2002: 'RBClass does not understand
> > #whichClassIncludesSelector:'
> > RBClass(Object)>>doesNotUnderstand:
> > RemoveMethodRefactoring>>justSendsSuper:
>...
>
> Thanks for catching this bug. It seems to be a problem with the RB, and
> is also reproducible in VA (haven't checked any other dialects yet).

Unfortunately, it works the same on all versions :(.

> This fix seems to work:
>
> !RBAbstractClass methodsFor!
>
> whichClassIncludesSelector: aSelector
>  ^self whoDefinesMethod: aSelector ! !
> !RBAbstractClass categoriesFor: #whichClassIncludesSelector:!method
> accessing!public! !
>
> Maybe John Brant has fixed this, or has a better implementation.

Nope, I hadn't fixed it before. However, I do have a better implementation.
The "class superclass" object will always be a RB class object, so we can
just change the #whichClassIncludesSelector: send in #justSendsSuper: to
send #whoDefinesMethod: instead.


John Brant