[aspectc-user] Bugreport: Poincut-Designator not working

Olaf Spinczyk Olaf.Spinczyk at informatik.uni-erlangen.de
Thu Oct 24 10:44:28 CEST 2002


Hi,

Am Mittwoch 23 Oktober 2002 22:01 schrieb Dominik Sacher:
> Dear all!
>
> [BUGREPORT]
> Poincuts do not "find" the correct joinpoints, if the specified
> Return-Type is a pointer.
>
>
> [EXAMPLE]
> Having this class:
> class ClassX{
>
> private:
> int a;
> char* b;
> int* c;
>
> public:
>   int   getA() { return a; }
>   char* getB() { return b; }
>   int*  getC() { return c; }
>
> //...
> };
>
>
> does this Pointcut change all methods: (OK!)
> pointcut pc_ClassX_GETTER() =  execution("% ClassX::get%()");
> advice pc_ClassX_GETTER() : after() {
>     cout << "AFTER" << endl;
> }
>
>
> but neither this Pointcut changes any method: (BUG!)
> pointcut pc_ClassX_GETTER() =  execution("char* ClassX::get%()");
> ...
>
> nor this one:
> pointcut pc_ClassX_GETTER() =  execution("int* ClassX::get%()");
> ...

This is a bug :-(

The internal signature of "char* getB ()" is stored as "char * getB()". Thus, 
you can match functions returning a pointer to a character like this:

 pointcut pc_ClassX_GETTER() =  execution("char * ClassX::get%()");
(the space between "char" and "*" is important!).

This is an unintended behavior of the AspectC++ matching routine and will be 
fxed in future releases. You can savely use the workaround "char *" now and 
later, because this will be supported as well.

BTW, we have the same problem and workaround with "char &".

Yours,

Olaf



More information about the aspectc-user mailing list