summaryrefslogtreecommitdiffstats
path: root/tests/java5
diff options
context:
space:
mode:
authoracolyer <acolyer>2005-02-17 12:58:24 +0000
committeracolyer <acolyer>2005-02-17 12:58:24 +0000
commitb4574b90b2db6cdae830e702825d86957447c3b9 (patch)
treed93001dbf1804933f64350dbd52bc1ced5402e7c /tests/java5
parentdb5e1868bb553bad01441e70db166ac4429de2f2 (diff)
downloadaspectj-b4574b90b2db6cdae830e702825d86957447c3b9.tar.gz
aspectj-b4574b90b2db6cdae830e702825d86957447c3b9.zip
support for annotations on ITDs, and declare annotation
Diffstat (limited to 'tests/java5')
-rw-r--r--tests/java5/annotations/aspectMembers/a/AnnotatedAspect.aj23
-rw-r--r--tests/java5/annotations/aspectMembers/a/AnnotatedAspect02.aj22
-rw-r--r--tests/java5/annotations/aspectMembers/a/AnnotatedAspect03.aj26
-rw-r--r--tests/java5/annotations/aspectMembers/a/AnnotatedAspect04.aj15
-rw-r--r--tests/java5/annotations/aspectMembers/a/Annotations.java29
-rw-r--r--tests/java5/annotations/aspectMembers/a/Foo.java17
-rw-r--r--tests/java5/annotations/declare/BasicParseTest.aj15
-rw-r--r--tests/java5/pseudoKeywords/MethodCalledAround.java3
-rw-r--r--tests/java5/pseudoKeywords/MethodCalledAroundAspect.java3
9 files changed, 153 insertions, 0 deletions
diff --git a/tests/java5/annotations/aspectMembers/a/AnnotatedAspect.aj b/tests/java5/annotations/aspectMembers/a/AnnotatedAspect.aj
new file mode 100644
index 000000000..03165b105
--- /dev/null
+++ b/tests/java5/annotations/aspectMembers/a/AnnotatedAspect.aj
@@ -0,0 +1,23 @@
+package a;
+
+@TypeAnnotation
+public aspect AnnotatedAspect {
+
+ @FieldAnnotation int foo = 5;
+
+ @MethodAnnotation int getFoo() { return foo; }
+
+ @ConstructorAnnotation
+ public AnnotatedAspect() {}
+
+}
+
+aspect VerifyAnnotations {
+
+ declare warning : set(@FieldAnnotation * *) : "annotated field";
+ declare warning : execution(@MethodAnnotation * *(..)) : "annotated method";
+ declare warning : execution(@ConstructorAnnotation new(..)) : "annotated constructor";
+ declare warning : staticinitialization(@TypeAnnotation *) : "annotated type";
+
+
+} \ No newline at end of file
diff --git a/tests/java5/annotations/aspectMembers/a/AnnotatedAspect02.aj b/tests/java5/annotations/aspectMembers/a/AnnotatedAspect02.aj
new file mode 100644
index 000000000..d92dc33b1
--- /dev/null
+++ b/tests/java5/annotations/aspectMembers/a/AnnotatedAspect02.aj
@@ -0,0 +1,22 @@
+package a;
+
+@MethodAnnotation
+public aspect AnnotatedAspect02 {
+
+ @TypeAnnotation int goo;
+
+ @FieldAnnotation int getGoo() { return goo; }
+
+ @AnnotationAnnotation AnnotatedAspect02() { goo = 5; }
+
+}
+
+aspect VerifyAnnotations {
+
+ declare warning : set(@FieldAnnotation * *) : "annotated field";
+ declare warning : execution(@MethodAnnotation * *(..)) : "annotated method";
+ declare warning : execution(@ConstructorAnnotation new(..)) : "annotated constructor";
+ declare warning : staticinitialization(@TypeAnnotation *) : "annotated type";
+
+
+} \ No newline at end of file
diff --git a/tests/java5/annotations/aspectMembers/a/AnnotatedAspect03.aj b/tests/java5/annotations/aspectMembers/a/AnnotatedAspect03.aj
new file mode 100644
index 000000000..939285816
--- /dev/null
+++ b/tests/java5/annotations/aspectMembers/a/AnnotatedAspect03.aj
@@ -0,0 +1,26 @@
+package a;
+
+@TypeAnnotation
+public aspect AnnotatedAspect03 {
+
+ @FieldAnnotation int foo = 5;
+
+ @FieldAnnotation private int ITDMe.goo = 3;
+
+ @MethodAnnotation private int ITDMe.getGoo() { return goo; }
+
+ @ConstructorAnnotation public ITDMe.new(int x) { goo = x; }
+
+}
+
+class ITDMe {}
+
+aspect VerifyAnnotations {
+
+ declare warning : set(@FieldAnnotation * *) : "annotated field";
+ declare warning : execution(@MethodAnnotation * *(..)) : "annotated method";
+ declare warning : execution(@ConstructorAnnotation new(..)) : "annotated constructor";
+ declare warning : staticinitialization(@TypeAnnotation *) : "annotated type";
+
+
+} \ No newline at end of file
diff --git a/tests/java5/annotations/aspectMembers/a/AnnotatedAspect04.aj b/tests/java5/annotations/aspectMembers/a/AnnotatedAspect04.aj
new file mode 100644
index 000000000..c19b057a3
--- /dev/null
+++ b/tests/java5/annotations/aspectMembers/a/AnnotatedAspect04.aj
@@ -0,0 +1,15 @@
+package a;
+
+@TypeAnnotation
+public aspect AnnotatedAspect04 {
+
+ @ConstructorAnnotation private int ITDMe.goo = 3;
+
+ @FieldAnnotation private int ITDMe.getGoo() { return goo; }
+
+ @TypeAnnotation public ITDMe.new(int x) { goo = x; }
+
+ @MethodAnnotation int ITDMe.foo = 2; // known limitation - no warning
+}
+
+class ITDMe {}
diff --git a/tests/java5/annotations/aspectMembers/a/Annotations.java b/tests/java5/annotations/aspectMembers/a/Annotations.java
new file mode 100644
index 000000000..21a0bb1a7
--- /dev/null
+++ b/tests/java5/annotations/aspectMembers/a/Annotations.java
@@ -0,0 +1,29 @@
+package a;
+
+import java.lang.annotation.*;
+
+@Target(ElementType.ANNOTATION_TYPE)
+@interface AnnotationAnnotation {}
+
+@Target(ElementType.CONSTRUCTOR)
+@interface ConstructorAnnotation {}
+
+@Target(ElementType.FIELD)
+@interface FieldAnnotation {}
+
+@Target(ElementType.LOCAL_VARIABLE)
+@interface LocalVarAnnotation {}
+
+@Target(ElementType.METHOD)
+@interface MethodAnnotation {}
+
+@Target(ElementType.PACKAGE)
+@interface PackageAnnotation {}
+
+@Target(ElementType.PARAMETER)
+@interface ParameterAnnotation {}
+
+@Target(ElementType.TYPE)
+@interface TypeAnnotation {}
+
+@interface AnyAnnotation {} \ No newline at end of file
diff --git a/tests/java5/annotations/aspectMembers/a/Foo.java b/tests/java5/annotations/aspectMembers/a/Foo.java
new file mode 100644
index 000000000..3fd621e26
--- /dev/null
+++ b/tests/java5/annotations/aspectMembers/a/Foo.java
@@ -0,0 +1,17 @@
+package a;
+
+/**
+ * @author colyer
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+@TypeAnnotation
+public class Foo {
+
+ @FieldAnnotation int foo;
+
+ @MethodAnnotation int getFoo() { return foo; }
+
+ @MethodAnnotation int goo;
+}
diff --git a/tests/java5/annotations/declare/BasicParseTest.aj b/tests/java5/annotations/declare/BasicParseTest.aj
new file mode 100644
index 000000000..5c3eca249
--- /dev/null
+++ b/tests/java5/annotations/declare/BasicParseTest.aj
@@ -0,0 +1,15 @@
+public aspect BasicParseTest {
+
+ declare warning : set(* *) : "setting";
+
+ declare @field: * foo : @MyAnnotation;
+
+ declare @method: * foo() : @MyAnnotation;
+
+ declare @constructor: Foo*.new(..) : @MyAnnotation;
+
+ declare @type: org.xyz..* : @MyAnnotation;
+
+}
+
+@interface MyAnnotation {} \ No newline at end of file
diff --git a/tests/java5/pseudoKeywords/MethodCalledAround.java b/tests/java5/pseudoKeywords/MethodCalledAround.java
new file mode 100644
index 000000000..799b5b197
--- /dev/null
+++ b/tests/java5/pseudoKeywords/MethodCalledAround.java
@@ -0,0 +1,3 @@
+public class MethodCalledAround {
+ void around() { ; }
+} \ No newline at end of file
diff --git a/tests/java5/pseudoKeywords/MethodCalledAroundAspect.java b/tests/java5/pseudoKeywords/MethodCalledAroundAspect.java
new file mode 100644
index 000000000..d20bc7bce
--- /dev/null
+++ b/tests/java5/pseudoKeywords/MethodCalledAroundAspect.java
@@ -0,0 +1,3 @@
+public aspect MethodCalledAroundAspect {
+ void around() { ; }
+} \ No newline at end of file