Subject: Correction to: Minor bug in the Any class...
From: Paul Freeman (pfreeman@ccs.neu.edu)
Date: Sun Oct 13 2002 - 11:59:17 EDT
Hi Karl -
Actually, to be technically correct it should be either one of the
following:
private pointcut scope(): !within(lawOfDemeter..*) &&
!cflow(execution(* lawOfDemeter..*(..))); // not in this package or
within the controlflow of the execution of a method in this package
OR
private pointcut scope(): !within(lawOfDemeter..*) &&
!cflowbelow(call(* lawOfDemeter..*(..))); // not in this package or
within the controlflow of a call to a method in this package
I suggest this ammendment as, even though no calls should be made from
outside the scope of our package to an object in our package,
"!cflow(call(* lawOfDemeter..*(..)))" would disallow checking a call TO
an object in our lawOfDemeter package. My understanding is that cflow
includes the current joinpoint as well as those that follow. The above
two suggested corrections would not include this initial call to a
object in our package.
Paul
Paul Freeman wrote:
> Hi Karl -
>
> While working with homework 3, I noticed that there is a slight bug in
> the Any class. The declaration of the "scope" pointcut is to broad,
> allowing for possible infinite recursions. I believe it should be:
>
> private pointcut scope(): !within(lawOfDemeter..*) &&
> !cflow(call(* lawOfDemeter..*(..))); // not in this package or
> within the
> //
> controlflow of a call in this package
>
> I noticed this problem when testing the argument checker (part 2) with
> the Foo class from HW2. The Foo class overrides the method
> "toString()" from object. This is significant because it is possible
> to call Foo's toString method from within the Supplier.at(JoinPoint
> jp) method call. Supplier's method at produces a string by
> concatinating "jp.getThis()" (as well as jp.getTarget()) to another
> string. Since the call to "jp.getThis()" in a string concatination in
> the Java language is actually translated to "jp.getThis().toString()"
> by the java compiler, if we are examining method executions with our
> Checker aspect and we call Supplier.at from within the execution
> examination, we can infinately recurse while examining
> Foo.toString(). The above addition of:
> !cflow(call(* lawOfDemeter..*(..)))
> to the scope class will alleviate any infinite recursions by calling
> methods in our lawOfDemeter package that we are examining outside of
> our lawOfDemeter package.
>
> Do you agree?
>
> Paul
>
>
>
>
This archive was generated by hypermail 2b28 : Sun Oct 13 2002 - 12:01:47 EDT