Subject: Minor bug in the Any class...
From: Paul Freeman (pfreeman@ccs.neu.edu)
Date: Sun Oct 13 2002 - 11:03:10 EDT
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 - 11:05:58 EDT