Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Covariant return types

I could possibly see the matching of the covariant one a bug, but i'd
need to think a little more.

This pointcut matches only the top level declaration:

declare warning: execution(Collection<? extends Test> *.test( .. )) &&
!execution(Collection<Test> *.test(..)) :
	"Covariant";

Andy

On 23 April 2010 03:02, Mohan Radhakrishnan
<radhakrishnan.mohan@xxxxxxxxx> wrote:
> Hi,
>        This joinpoint matches both methods with Covariant return
> types properly. Is it possible to match only one ?
>
> Thanks,
> Mohan
>
> declare warning: execution(Collection<? extends Test> *.test( .. )) :
> "Covariant";
>
> public class CovariantSuper {
>
>        public Collection<? extends Test> test(){
>                return null;
>        }
>
>        public Class<?> test1(){
>                return null;
>        }
>
> }
>
> package com.test;
>
> import java.util.Collection;
>
> public class CovariantSub extends CovariantSuper{
>
>        public Collection<Test> test(){
>                return null;
>        }
>
>        @SuppressWarnings("unchecked")          // This is required.
> Otherwise I don't see the eclipse marker.
>        public Class test1(){
>                return null;
>        }
>
> }
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>


Back to the top