[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Unknown AspectJ Error Message

Perhaps it is a bug where the compiler does not recognize
the equivalence of the "this" PCD/nested type in applying 
this rule (from the programming guide):
-----------------
The most important rule is that all the pointcut parameters 
must be bound at every join point picked out by the pointcut. 
So, for example, the following pointcut definition will 
result in a compilation error:

  pointcut badPointcut(Point p1, Point p2):
      (target(p1) && call(void setX(int))) ||
      (target(p2) && call(void setY(int)));

because p1 is only bound when calling setX, and p2 is only 
bound when calling setY, but the pointcut picks out all of 
these join points and tries to bind both p1 and p2.
-----------------

It seems like the implementation is prohibiting an alternative
binding, even when it is semantically the same, because it is
also matching.  (I'd think the applicable rule would be that
the same parameter cannot be bound by two PCD's at a join
point, to avoid ambiguity in where the value came from.
But there would be an exclusion (not enforced here) when the
PCD's are identical.)

Here it should be possible to staticly distinguish the 
one-arg from the two-arg case in the two forks of the 
pointcut.  But I wonder about the pointcut

  execution(public void DoubleMetaphoneResult.append(..))
  && args(param_0, ..)

which should pick up both execution join points.

Does it work if instead it uses (generates) this?

-------
 execution(public void DoubleMetaphoneResult.append(..))
 && this(refObj)
 && (args(param_0) || args(param_0, char))
-------

[todo: there's no discussion on point in the semantics
section of the programming guide]

Wes

> ------------Original Message------------
> From: Maximilian Stoerzer <stoerzer@xxxxxxxxxxxxxxxxx>
> To: aspectj-users@xxxxxxxxxxx
> Date: Thu, Oct-28-2004 0:25 AM
> Subject: [aspectj-users] Unknown AspectJ Error Message
>
> Hi everybody,
> 
> when applying advice to an inner class I get the following error 
> message (quote):
> 
> Cannot use this() to match at this location and bind a formal to type 
> 'org.apache.commons.codec.language.DoubleMetaphone$DoubleMetaphoneResult' - the 
> formal is already bound to type 
> 'org.apache.commons.codec.language.DoubleMetaphone$DoubleMetaphoneResult'.  The 
> secondary source location points to the problematic this().
> 
> The corresponding pointcut definition is the following:
> 
> public pointcut contextCall_ (char param_0, 
> org.apache.commons.codec.language.DoubleMetaphone.DoubleMetaphoneResult 
> refObj) 
> (execution(public void 
> org.apache.commons.codec.language.DoubleMetaphone.DoubleMetaphoneResult.append(char))
>   && args(param_0) && this(refObj)) || (execution(public  void 
> org.apache.commons.codec.language.DoubleMetaphone.DoubleMetaphoneResult.append(char, 
> char)) && args(param_0, char) && this(refObj));
> 
> (looks a bit odd because it is generated).
> 
> Has anyone experienced this kind of error before? What is the problem 
> here? I have 
> to admit that I do not understand the error message.
> 
> Thanks for any hints!
> 
> Best regards,	
> 	Max
> 
> -- 
> Maximilian Stoerzer
> Lehrstuhl Software Systeme - FMI - University of Passau
> Tel: +49 851 509 3096, eMail: stoerzer@xxxxxxxxxxxxxxxxx
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> http://dev.eclipse.org/mailman/listinfo/aspectj-users
>