diff options
author | aclement <aclement> | 2006-10-24 12:42:57 +0000 |
---|---|---|
committer | aclement <aclement> | 2006-10-24 12:42:57 +0000 |
commit | 7b40e7e3e4b68d6b0334f5643931e00f06881cdd (patch) | |
tree | 55220f868d7a27c45383ea4980ec8ca7a179cd2d /tests/bugs153 | |
parent | 70dda814951a9cf2f79e958b2bd93f66f390b6da (diff) | |
download | aspectj-7b40e7e3e4b68d6b0334f5643931e00f06881cdd.tar.gz aspectj-7b40e7e3e4b68d6b0334f5643931e00f06881cdd.zip |
tests and fixes for 161502: annotation style generic pointcuts (!)
Diffstat (limited to 'tests/bugs153')
-rw-r--r-- | tests/bugs153/pr161502/Main.java | 34 | ||||
-rw-r--r-- | tests/bugs153/pr161502/Main2.java | 34 |
2 files changed, 68 insertions, 0 deletions
diff --git a/tests/bugs153/pr161502/Main.java b/tests/bugs153/pr161502/Main.java new file mode 100644 index 000000000..81a1eae09 --- /dev/null +++ b/tests/bugs153/pr161502/Main.java @@ -0,0 +1,34 @@ +import java.util.ArrayList; +import java.util.List; +import org.aspectj.lang.ProceedingJoinPoint; +import org.aspectj.lang.annotation.Around; +import org.aspectj.lang.annotation.Aspect; + +public class Main { + + public List<? extends Element> getElements() { + return new ArrayList<Element>(); + } + + class Element {}; + + @Aspect + static abstract class Base<T> { + @Around("call(List<? extends T> *.*(..))") + public List<? extends T> elementList(ProceedingJoinPoint thisJoinPoint) { + try { + return (List<? extends T>)thisJoinPoint.proceed(); + } catch (Throwable e) { + throw new RuntimeException(e); + } + } + } + + @Aspect + static class Concrete extends Base<Element> {} + + public static void main(String[] args) { + new Main().getElements(); + } + +}
\ No newline at end of file diff --git a/tests/bugs153/pr161502/Main2.java b/tests/bugs153/pr161502/Main2.java new file mode 100644 index 000000000..b87503b28 --- /dev/null +++ b/tests/bugs153/pr161502/Main2.java @@ -0,0 +1,34 @@ +import java.util.ArrayList; +import java.util.List; +import org.aspectj.lang.ProceedingJoinPoint; +import org.aspectj.lang.annotation.Around; +import org.aspectj.lang.annotation.Aspect; + +public class Main2 { + + public List<? extends Element> getElements() { + return new ArrayList<Element>(); + } + + class Element {}; + + @Aspect + static abstract class Base<T> { + @Around("call(List<? extends T> *.*(..))") + public List<? extends T> elementList(ProceedingJoinPoint thisJoinPoint) { + try { + return (List<? extends T>)thisJoinPoint.proceed(); + } catch (Throwable e) { + throw new RuntimeException(e); + } + } + } + + @Aspect + static class Concrete extends Base<String> {} // pointcut won't match because not a call to "List<? extends String> *(..)" + + public static void main(String[] args) { + new Main2().getElements(); + } + +}
\ No newline at end of file |