VA 8 Beta 1: StsPowerTools bug

VA Smalltalk is a "100% VisualAge compatible" IDE that includes the original VisualAge technology and the popular VA Assist and WidgetKit add-ons.

Moderators: Eric Clayberg, wembley, tc, Diane Engles, solveig

VA 8 Beta 1: StsPowerTools bug

Postby ernest.micklei » Wed Jan 21, 2009 7:57 am

Hi,

While in a StsClassBrowser and configuring the context menu,
the browser object is requested for the stsSelectedType which sends the message:

StsPowerTools methodSelectorExists: (symbol...)

Sometimes this returns nil instead of a Boolean causing the well-known mustBeBoolean error.

Looking at the source code of methodSelectorExists:, there is indeed a possible execution path that returns nil.
To be more specific, this happens when a fresh new symbol has been selected in the text.
Try typing #cloudfork1 in your code browser and open the context menu.
ernest.micklei
 
Posts: 6
Joined: Tue Dec 02, 2008 12:44 am

Re: VA 8 Beta 1: StsPowerTools bug

Postby Diane Engles » Fri Jan 23, 2009 2:31 pm

Hello,

I have not been able to reproduce your error.

Here is what I tried in a VA 8 Beta image:

1. Open a class browser on EsString.

2. Select method abtSeparateIntoDrawnLinesLength: anInteger font: aFont

3. Modify a line of code to be lines := #newotherSym ( a "fresh, new symbol"?)

4. Highlight #newotherSym and right click to popup the menu

Can you post some more detailed steps that will reliably reproduce the error?

Thanks
Instantiations Smalltalk Support
diane@instantiations.com
Diane Engles
Moderator
 
Posts: 66
Joined: Mon Oct 16, 2006 2:40 pm

Re: VA 8 Beta 1: StsPowerTools bug

Postby ernest.micklei » Wed Jan 28, 2009 1:16 pm

Hi,

In order to reproduce the problem, it is important that the new symbol is not yet picked up by the compiler and stored in the Symbol table.
So, looking at your step 3. Did you format or save the source before opening the menu? Again, the offending method in StsPowerTools is not completely safe, IMHO.

If my comments did not help, I will try harder explaining explain what I did.

^Ernest
ernest.micklei
 
Posts: 6
Joined: Tue Dec 02, 2008 12:44 am

Re: VA 8 Beta 1: StsPowerTools bug

Postby Diane Engles » Thu Jan 29, 2009 2:01 pm

Hi,

I did not format or save the code before popping up the menu. I tried it several times with different symbols which were brand new to the system. Perhaps more details will allow me to reproduce your results.

Regards,

Diane
Instantiations Smalltalk Support
diane@instantiations.com
Diane Engles
Moderator
 
Posts: 66
Joined: Mon Oct 16, 2006 2:40 pm

Re: VA 8 Beta 1: StsPowerTools bug

Postby ernest.micklei » Fri Jan 30, 2009 2:19 am

Hello Diane,

See below the steps to reproduce the problem with the source that causes it.

1. Open Class Browser on StsPowerTools
2. Go to class method methodSelectorExists:
3. Insert a '#' before the variable MethodSelectors in the first statement
4. Append 'NEW' to the variable MethodSelectors

Source should now be:

methodSelectorExists: selector

#MethodSelectorsNEW isNil ifTrue: [^true].

5. Now select new Symbol '#MethodSelectorsNEW' (e.g. by double-click, the pound sign is irrelevant)
6. Popup the context menu
7. A debugger opens with "receiver must be a boolean"

If this still does not help then I will create a screencast :-)

Regards,

Ernest Micklei
ernest.micklei
 
Posts: 6
Joined: Tue Dec 02, 2008 12:44 am

Re: VA 8 Beta 1: StsPowerTools bug

Postby wembley » Fri Jan 30, 2009 12:35 pm

Ernest -

I have tried your steps in a V8 Beta 1 image, but I do not get your results. Instead the context menu pops up as expected and I see no debugger.

Could you please save the stack trace from the debugger into a file and upload it to the forum. Perhaps this will give us some idea of what is going on.
John O'Keefe [|], Principal Smalltalk Architect, Instantiations Inc.
wembley
Moderator
 
Posts: 405
Joined: Mon Oct 16, 2006 3:01 am
Location: Durham, NC

Re: VA 8 Beta 1: StsPowerTools bug

Postby ernest.micklei » Sat Jan 31, 2009 10:56 am

Hi,

Find attached the stack you asked for.
I could not find indications that other extensions or tools are causing this.
Let me know if can help you in any way.

^Ernest
Attachments
stspowertools_problem_stack.txt
stack trace from debugger when reproducing "bug"
(5.16 KiB) Downloaded 33 times
ernest.micklei
 
Posts: 6
Joined: Tue Dec 02, 2008 12:44 am

Re: VA 8 Beta 1: StsPowerTools bug

Postby wembley » Mon Feb 02, 2009 11:28 am

Ernest -

Note: typo corrected: stsSelectorType -> stsSelectedType

Thanks for posting the stack trace. Unfortunately, while it does point to a particular failing method, it does not identify where in that method the code is failing. I have run your test after setting a breakpoint at the beginning of EtWindow>>#stsSelectedType. Then I step through the EtWindow>>#stsSelectedType code:
Code: Select all
   | symbol object |
   (symbol := self stsPossibleSelectorNoSelectIn: self targetTextWidget) isNil
      ifFalse: [
         symbol first == $#
            ifTrue: [
               (StsPowerTools methodSelectorExists: (symbol reject: [:char | char == $#]))
                  ifTrue: [^##selector]
                  ifFalse: [^##symbol]].
" ... rest of method ..."

I see symbol being set to '#MethodSelectorsNEW' in the first line of code and then it works its way down to where it returns ##symbol. At that point I resume and the context menu pops up. No matter what I do, it always succeeds.

Perhaps you could try this test and see where your execution path is different.
John O'Keefe [|], Principal Smalltalk Architect, Instantiations Inc.
wembley
Moderator
 
Posts: 405
Joined: Mon Oct 16, 2006 3:01 am
Location: Durham, NC

Re: VA 8 Beta 1: StsPowerTools bug

Postby ernest.micklei » Tue Feb 03, 2009 1:17 am

Hi,

All of this indicates that we do not have the same image. So I will provide some more details.
The following expression evaluates to nil:

StsPowerTools methodSelectorExists: '#blabla'

whereas in your image it return false (as expected).
In my image, I have the following method definition information:

Application Version: StsPowerTools V 7.5.3 [106]
Method Edition: 22-04-2008 04:40:22

StsPowerTools>>methodSelectorExists: selector

MethodSelectors isNil ifTrue: [^true].
self checkSpelling ifFalse: [^true].
^(MethodSelectors includes: selector)
ifTrue: [ true ]
ifFalse: [
(Symbol symbolTable includes: selector)
ifTrue: [
StsPowerTools refreshMethodSelectors .
true ] ]

I am running out of suggestions.

^Ernest
ernest.micklei
 
Posts: 6
Joined: Tue Dec 02, 2008 12:44 am

Re: VA 8 Beta 1: StsPowerTools bug

Postby benvandijk » Tue Feb 03, 2009 2:40 am

Hi John,

We must have a different beta1 image. Mine works the same as the one from Ernest.
The method you mention: EtWindow>>#stsSelectorType, is not even in my image.
We have a method: EtWindow>>#stsSelectedType, which does the same thing.
Might be a typo but i do not expect one from you :)

A suggestion for Ernest:
Change the code to

Code: Select all
methodSelectorExists: selector

MethodSelectors isNil ifTrue: [^true].
self checkSpelling ifFalse: [^true].
^(MethodSelectors includes: selector)
  ifTrue: [ true ]
  ifFalse: [
   (Symbol symbolTable includes: selector)
   ifTrue: [
    StsPowerTools refreshMethodSelectors .
    true ]
   ifFalse: [ false ] ]


The ifTrue: will return nil if the condition is false, so the ifFalse: is necessary
benvandijk
 
Posts: 45
Joined: Sun Feb 25, 2007 7:14 am
Location: Arnhem, Netherlands

Re: VA 8 Beta 1: StsPowerTools bug

Postby wembley » Tue Feb 03, 2009 5:09 am

Ben and Ernest -

Yes, a typo :oops: -- I have corrected the original post.

Next, the fix (the symptoms are different, but this is the same problem):

38505: VA Assist Undefined method warning is not shown
Create a method and type 'self abc', assuming 'abc' is not defined, and save it.

In the browser, 'abc' should be highlighted to show it is undefined and a yellow triangle, warning sign, should appear next to the method in the method list.

This no longer works in V 8.0 with the new and old browsers.

Changed:
IBM Smalltalk, ALL - UI
VA Assist Pro for VisualAge
Test:
1) Create a method and type 'self abc', assuming 'abc' is
not defined, and save it.
2) In the browser, 'abc' should be highlighted to show it
is undefined and a yellow trangle, warning sign, should
appear next to the method in the method list.

The modified code (which reverts to the 1/7/1999 version):
Code: Select all
StsPowerTools>>#methodSelectorExists: selector

   MethodSelectors isNil ifTrue: [^true].
   self checkSpelling ifFalse: [^true].
   ^MethodSelectors includes: selector

and:
Code: Select all
AbtFeatureLoader>>#promptForFeaturesToLoad

   | userCancelled stsTools |

   "Assume the cancel button has not been clicked"
   userCancelled := false.

   Transcript
      execLongOperation: [:dialog |
         dialog fractionComplete: 0.
         "Determine if user has clicked the cancel button by checking for nil result"
         (self initialize: dialog) ifNil: [userCancelled := true].
      ]
      message: AbtFeatureLoadPool::AbtInsLoadStatus
      allowCancel: true
      showProgress: true.

   "If cancelled by user, return without displaying the prompter"
   userCancelled ifTrue: [^nil].

   self loadUnloadCancelled: true.
   AbtFeatureLoaderPrompter new
      loader: self ;
      prompt.
      
   self loadUnloadCancelled ifFalse:[
      self loadUnload.
      ].

   (stsTools := Smalltalk classAt: #StsPowerTools) isNil
      ifFalse: [ stsTools refreshMethodSelectors ].
      
"  self new promptForFeaturesToLoad   "


And the reason that I couldn't see the problem was that I had this fix loaded in my Beta1 image.
John O'Keefe [|], Principal Smalltalk Architect, Instantiations Inc.
wembley
Moderator
 
Posts: 405
Joined: Mon Oct 16, 2006 3:01 am
Location: Durham, NC


Return to VA Smalltalk 7.0, 7.5 & 8.0

Who is online

Users browsing this forum: Yahoo [Bot] and 1 guest