Accessing smalltalk classes after model computation

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

Accessing smalltalk classes after model computation

cdelaunay
Hello,

I'm not sure this is a problem, but here is the error I had:

FAMIXMethod >> numberOfMessageSends
<property: #MSG longName: 'Number of message sends' description:
'The number of message from a method'>
^self
lookUpPropertyNamed: #MSG
computedAs:
[self mooseModel isSmalltalk
ifTrue:
[| parser |
parser := VisualWorksParseTreeMetricCalculator new.
parser processMethod: self usingImporter: nil inModel: nil.
parser numberOfMessageSends]
ifFalse: [-1]]

Here, to compute this property, we ask the smalltalk compiled method (throught the method in bold).
So, if I generate a model, then remove a method in pharo, then ask the corresponding FAMIXMethod for #numberOfMessageSends, it will raise an error because it does not find the compiled method anyMore.
Maybe we should force the computation of this kind of property at the model computation ?


_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: Accessing smalltalk classes after model computation

simondenier

On 22 juin 2011, at 10:36, Cyrille Delaunay wrote:

Hello,

I'm not sure this is a problem, but here is the error I had:

FAMIXMethod >> numberOfMessageSends
<property: #MSG longName: 'Number of message sends' description:
'The number of message from a method'>
^self
lookUpPropertyNamed: #MSG
computedAs:
[self mooseModel isSmalltalk
ifTrue:
[| parser |
parser := VisualWorksParseTreeMetricCalculator new.
parser processMethod: self usingImporter: nil inModel: nil.
parser numberOfMessageSends]
ifFalse: [-1]]

Here, to compute this property, we ask the smalltalk compiled method (throught the method in bold).
So, if I generate a model, then remove a method in pharo, then ask the corresponding FAMIXMethod for #numberOfMessageSends, it will raise an error because it does not find the compiled method anyMore.
Maybe we should force the computation of this kind of property at the model computation ?

Nope, since the idea is to lazily compute metrics.

I would rather add an exception handler to catch such error and return -1


--
Simon Denier




_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: Accessing smalltalk classes after model computation

abergel
In reply to this post by cdelaunay
Maybe a method MooseModel>>detachFromExternalResources or MooseModel>>isolate would be welcome
It would have the effect to compute all the necessary metrics.

Alexandre


On 22 Jun 2011, at 04:36, Cyrille Delaunay wrote:

> Hello,
>
> I'm not sure this is a problem, but here is the error I had:
>
> FAMIXMethod >> numberOfMessageSends
> <property: #MSG longName: 'Number of message sends' description:
> 'The number of message from a method'>
>
> ^self
> lookUpPropertyNamed: #MSG
> computedAs:
> [self mooseModel isSmalltalk
> ifTrue:
> [| parser |
> parser := VisualWorksParseTreeMetricCalculator new.
> parser processMethod: self usingImporter: nil inModel: nil.
> parser numberOfMessageSends]
> ifFalse: [-1]]
>
> Here, to compute this property, we ask the smalltalk compiled method (throught the method in bold).
> So, if I generate a model, then remove a method in pharo, then ask the corresponding FAMIXMethod for #numberOfMessageSends, it will raise an error because it does not find the compiled method anyMore.
> Maybe we should force the computation of this kind of property at the model computation ?
>
> _______________________________________________
> Moose-dev mailing list
> [hidden email]
> https://www.iam.unibe.ch/mailman/listinfo/moose-dev

--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.





_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev