Hi, I *think* you are hitting a variant of this issue (from 2004): https://bugs.eclipse.org/bugs/show_bug.cgi?id=61568 - which is still not addressed. It needs a large bunch of work doing and the workaround is so easy that it hasn't become a priority. I know the workaround of duplicating the advice (once for each variant) isn't ideal.
cheers, Andy On 3 October 2013 12:47, Mike Noordermeer <m...@normi.net> wrote: > Hi all, > > I'm experiencing some issues with a pointcut, and have narrowed the > problem down to a small testcase. I'm using AspectJ 1.7.3. I hope > someone could tell me if my pointcut is wrong, or if AspectJ is doing > something weird. The testcase is: > > ========= > > import java.lang.Integer; > import java.util.*; > > public class AjTest { > public static void main(String[] args) { > C.a(new Date(), new ArrayList<Integer>()); > C.b(new ArrayList<Integer>(), 1); > } > > static class C { > static void a(Date dateParam, List<Integer> listParam) > { } > > static void b(List<Integer> listParam, int testParam) > { } > } > > static aspect A { > before (List<Integer> listParam): > execution(* C.a(.., List<Integer>)) && args(*, listParam) || > execution(* C.b(List<Integer>, ..)) && args(listParam, *) { > > } > } > > } > > ============ > > During compile, this gives an uncheckedArgument lint warning. During > run this _sometimes_ gives a ClassCastException (it's trying to cast > the Date to a List), but some compiles seem to work - it's really > non-deterministic. It seems like AspectJ sometimes matches the second > args() clause with the first execution() clause. Is my pointcut wrong > or unsupported, or is this a bug in AspectJ? > > Output of compile and run (when it goes wrong): > > =========== > > $ ~/aspectj1.7/bin/ajc -cp ~/aspectj1.7/lib/aspectjrt.jar -source 1.6 > AjTest.java > AjTest.java:21 [warning] unchecked match of List<Integer> with List > when argument is an instance of List at join point > method-execution(void AjTest$C.a(Date, List<Integer>)) > [Xlint:uncheckedArgument] > execution(* C.b(List<Integer>, ..)) && args(listParam, *) { > ^^^^^^^^^ > [Xlint:uncheckedArgument] > see also: AjTest.java:11::0 > > 1 warning > > =========== > > $ java -cp ~/aspectj1.7/lib/aspectjrt.jar:. AjTest > Exception in thread "main" java.lang.ClassCastException: > java.util.Date cannot be cast to java.util.List > at AjTest$C.a(AjTest.java:12) > at AjTest.main(AjTest.java:6) > > =========== > > Thanks in advance for your reply. > > -- > Regards, > > Mike Noordermeer > m...@normi.net > _______________________________________________ > aspectj-users mailing list > aspectj-users@eclipse.org > https://dev.eclipse.org/mailman/listinfo/aspectj-users >
_______________________________________________ aspectj-users mailing list aspectj-users@eclipse.org https://dev.eclipse.org/mailman/listinfo/aspectj-users