summaryrefslogtreecommitdiffstats
path: root/tests/java5
diff options
context:
space:
mode:
authoracolyer <acolyer>2005-07-13 12:59:45 +0000
committeracolyer <acolyer>2005-07-13 12:59:45 +0000
commitceb8d527356c158d321f49efb0ca53dc12762150 (patch)
treee38962e82751f16356e2e25e9f07e98ee8b34313 /tests/java5
parentc2606446912aae244297a74c6f68c11ed3832d30 (diff)
downloadaspectj-ceb8d527356c158d321f49efb0ca53dc12762150.tar.gz
aspectj-ceb8d527356c158d321f49efb0ca53dc12762150.zip
more test cases covering generics in pointcut expressions
Diffstat (limited to 'tests/java5')
-rw-r--r--tests/java5/generics/pointcuts/GenericSignatureMatching.aj17
-rw-r--r--tests/java5/generics/pointcuts/HandlerPointcutTests.aj13
-rw-r--r--tests/java5/generics/pointcuts/ParameterizedTypesInAnnotationPatterns.aj14
-rw-r--r--tests/java5/generics/pointcuts/ParameterizedTypesInAtPCDs.aj15
-rw-r--r--tests/java5/generics/pointcuts/PointcutsThatDontAllowTypeVars.aj28
5 files changed, 87 insertions, 0 deletions
diff --git a/tests/java5/generics/pointcuts/GenericSignatureMatching.aj b/tests/java5/generics/pointcuts/GenericSignatureMatching.aj
new file mode 100644
index 000000000..28faf00eb
--- /dev/null
+++ b/tests/java5/generics/pointcuts/GenericSignatureMatching.aj
@@ -0,0 +1,17 @@
+public aspect GenericSignatureMatching {
+
+ // tests that references to a generic or parameterized type are
+ // always matched by a type pattern refering to the raw type form
+
+ void someCode() {
+ ConcreteImplementingClass cic = new ConcreteImplementingClass();
+ cic.asInt(5.0d);
+ GenericImplementingClass<Long> gic = new GenericImplementingClass<Long>();
+ gic.asInt(55L);
+ }
+
+ declare warning :
+ execution<T>(* GenericInterface<T extends Number>.asInt(T)) :
+ "execution<T>(* GenericInterface<T extends Number>.asInt(T))";
+
+} \ No newline at end of file
diff --git a/tests/java5/generics/pointcuts/HandlerPointcutTests.aj b/tests/java5/generics/pointcuts/HandlerPointcutTests.aj
new file mode 100644
index 000000000..8324d198d
--- /dev/null
+++ b/tests/java5/generics/pointcuts/HandlerPointcutTests.aj
@@ -0,0 +1,13 @@
+public aspect HandlerPointcutTests {
+
+ // CE line 4 - no type variables allowed in handler
+ pointcut exceptionHandler() : handler<T>(GenericInterface<T>);
+
+ // CE line 8 - no parameterized types
+ // CW line 8 - unresolved absolute type name T
+ pointcut unboundTypeInHandler() : handler(GenericInterface<T>);
+
+ // CE line 11 - no parameterized types
+ pointcut parameterizedHandler() : handler(GenericInterface<Double>);
+
+} \ No newline at end of file
diff --git a/tests/java5/generics/pointcuts/ParameterizedTypesInAnnotationPatterns.aj b/tests/java5/generics/pointcuts/ParameterizedTypesInAnnotationPatterns.aj
new file mode 100644
index 000000000..54b538491
--- /dev/null
+++ b/tests/java5/generics/pointcuts/ParameterizedTypesInAnnotationPatterns.aj
@@ -0,0 +1,14 @@
+import java.util.List;
+
+public aspect ParameterizedTypesInAnnotationPatterns {
+ // CE - not an annotation type
+ pointcut simple() : staticinitialization(@List<String> String);
+ // CE - not an annotation type
+ pointcut generic() : staticinitialization<T>(@List<T> Class<T>);
+
+ // no CE, good enough for now? may improve error reporting for this later
+ pointcut combined() : staticinitialization(@(Foo || List<String>) String);
+
+}
+
+@interface Foo {} \ No newline at end of file
diff --git a/tests/java5/generics/pointcuts/ParameterizedTypesInAtPCDs.aj b/tests/java5/generics/pointcuts/ParameterizedTypesInAtPCDs.aj
new file mode 100644
index 000000000..d92cc7c73
--- /dev/null
+++ b/tests/java5/generics/pointcuts/ParameterizedTypesInAtPCDs.aj
@@ -0,0 +1,15 @@
+public aspect ParameterizedTypesInAtPCDs {
+
+ public pointcut atthis() : @this(List<String>);
+
+ public pointcut attarget() : @target(List<String>);
+
+ public pointcut atargs() : @args(List<String>);
+
+ public pointcut atannotation() : @annotation(List<String>);
+
+ public pointcut atwithin() : @within(List<String>);
+
+ public pointcut atwithincode() : @withincode(List<String>);
+
+} \ No newline at end of file
diff --git a/tests/java5/generics/pointcuts/PointcutsThatDontAllowTypeVars.aj b/tests/java5/generics/pointcuts/PointcutsThatDontAllowTypeVars.aj
new file mode 100644
index 000000000..15b622e49
--- /dev/null
+++ b/tests/java5/generics/pointcuts/PointcutsThatDontAllowTypeVars.aj
@@ -0,0 +1,28 @@
+public aspect PointcutsThatDontAllowTypeVars {
+
+ public pointcut handlerWithVars() : handler<T>(*);
+
+ public pointcut cflowWithVars() : cflow<T>(ifWithVars());
+
+ public pointcut cflowbelowWithVars() : cflowbelow<S>(ifWithVars());
+
+ public pointcut thisWithVars() : this<T>(String);
+
+ public pointcut targetWithVars() : target<T>(String);
+
+ public pointcut argsWithVars() : args<T>(String);
+
+ public pointcut atthisWithVars() : @this<T>(*);
+
+ public pointcut attargetWithVars() : @target<T>(*);
+
+ public pointcut atargsWithVars() : @args<T>(*);
+
+ public pointcut atwithinWithVars() : @within<T>(*);
+
+ public pointcut atwithincodeWithVars() : @withincode<T>(*);
+
+ public pointcut atannotationWithVars() : @annotation<T>(*);
+
+ public pointcut ifWithVars() : if<T>(true); // message for this one should be improved...
+} \ No newline at end of file