Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] super and extends in generic pointcuts

Hi

I manged to fix the matching for p11  public void func9(Collection<?
extends Simple1>s){ },
how is it possible to create a function to the second p12

pointcut p12() : execution (void Simple1.func10(Collection<? super>>
Interface1>));

Thanks,
Denes

2012/1/10 Andy Clement <andrew.clement@xxxxxxxxx>:
> Hi,
>
> execution() pointcuts take attempt to  match on the declared
> signature, your signatures are not declared as '? extends/super' so
> the pointcuts don't match.  This would match:
>
> execution(void Simple1.func*(Collection<Simple1+>))
>
> There is a section in the docs (although it is a bit short...):
> http://www.eclipse.org/aspectj/doc/next/adk15notebook/generics-inAspectJ5.html#matching-generic-and-parameterized-types-in-pointcut-expressions
> "Generic wildcards and signature matching"
>
> cheers
> Andy
>
> On 9 January 2012 12:23, Dénes Németh <mr.nemeth.denes@xxxxxxxxx> wrote:
>> Hi
>>
>> I wanted to write a small example to see how the super and extends
>> work in generic pointcut
>> matching, but p11 and p12 pointcut do not seem to match. Can someone
>> help me to figure
>> out what did I do wrong?
>>
>> public interface Interface1 { }
>>
>> public class Simple1 implements Interface1{
>>        public void func9(Collection<Simple1>s){ }
>>        public void func10(Collection<Simple1>s){ }
>> }
>>
>> pointcut p11() : execution (void Simple1.func9(Collection<? extends Simple1>));
>>
>> pointcut p12() : execution (void Simple1.func10(Collection<? super
>> Interface1>));
>>
>> Best wishes,
>> Denes
>> _______________________________________________
>> aspectj-users mailing list
>> aspectj-users@xxxxxxxxxxx
>> https://dev.eclipse.org/mailman/listinfo/aspectj-users
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users


Back to the top