]> source.dussan.org Git - aspectj.git/commitdiff
211052 - testcode
authoraclement <aclement>
Mon, 3 Dec 2007 14:52:58 +0000 (14:52 +0000)
committeraclement <aclement>
Mon, 3 Dec 2007 14:52:58 +0000 (14:52 +0000)
tests/bugs154/pr211052/DistantResource.java [new file with mode: 0644]
tests/bugs154/pr211052/MyPojo.java [new file with mode: 0644]
tests/bugs154/pr211052/SimpleAnnotation.java [new file with mode: 0644]
tests/bugs154/pr211052/SimpleAnnotation2.java [new file with mode: 0644]
tests/bugs154/pr211052/SimpleAspect1.java [new file with mode: 0644]
tests/bugs154/pr211052/SimpleAspect2.java [new file with mode: 0644]
tests/bugs154/pr211052/SimpleAspect3.java [new file with mode: 0644]
tests/bugs154/pr211052/SimpleAspect4.java [new file with mode: 0644]

diff --git a/tests/bugs154/pr211052/DistantResource.java b/tests/bugs154/pr211052/DistantResource.java
new file mode 100644 (file)
index 0000000..09b39a3
--- /dev/null
@@ -0,0 +1,12 @@
+package c.d;
+
+import java.lang.annotation.*;
+
+public class DistantResource {
+  public static void main(String []argv) {
+    Annotation [] annos = DistantResource.class.getAnnotations();
+    for (int i=0;annos!=null && i<annos.length;i++) {
+      System.out.println("Annotation is "+annos[i]);
+    }
+  }
+}
diff --git a/tests/bugs154/pr211052/MyPojo.java b/tests/bugs154/pr211052/MyPojo.java
new file mode 100644 (file)
index 0000000..b916d2e
--- /dev/null
@@ -0,0 +1,35 @@
+
+
+aspect ConfigureTracing {
+        declare @type : MyPojo : @Tracing(level = LoggingLevel.WARN);
+//        declare @method : * MyPojo.calculate() : @TestAnnotation;
+}
+
+@interface Tracing { LoggingLevel level(); }
+
+@interface TestAnnotation {}
+
+class Level {
+  Level(int i) {}
+  public final static Level INFO = new Level(1);
+  public final static Level WARN = new Level(2);
+  public final static Level ERROR = new Level(3);
+}
+//@Tracing(level = LoggingLevel.WARN)
+enum LoggingLevel {
+  INFO(Level.INFO),
+  WARN(Level.WARN),
+  ERROR(Level.ERROR);
+      
+  private final Level level;
+  private LoggingLevel(Level level) {this.level = level;}
+  public Level getLevel() {return level;}
+}
+
+public class MyPojo {
+  public static void calculate() {
+  }
+  public static void main(String []argv) {
+         
+  }
+}
diff --git a/tests/bugs154/pr211052/SimpleAnnotation.java b/tests/bugs154/pr211052/SimpleAnnotation.java
new file mode 100644 (file)
index 0000000..5877ab3
--- /dev/null
@@ -0,0 +1,8 @@
+package a.b;
+import java.lang.annotation.*;
+
+@Retention(RetentionPolicy.RUNTIME)
+@interface SimpleAnnotation {
+  String classname();
+}
+
diff --git a/tests/bugs154/pr211052/SimpleAnnotation2.java b/tests/bugs154/pr211052/SimpleAnnotation2.java
new file mode 100644 (file)
index 0000000..98781e7
--- /dev/null
@@ -0,0 +1,8 @@
+package e.f;
+import java.lang.annotation.*;
+
+@Retention(RetentionPolicy.RUNTIME)
+public @interface SimpleAnnotation2 {
+  String classname();
+}
+
diff --git a/tests/bugs154/pr211052/SimpleAspect1.java b/tests/bugs154/pr211052/SimpleAspect1.java
new file mode 100644 (file)
index 0000000..eae2e40
--- /dev/null
@@ -0,0 +1,6 @@
+package a.b;
+
+// explicitly reference target type in another package
+aspect SimpleAspect1 {
+  declare @type: c.d.DistantResource: @SimpleAnnotation(classname="oranges");
+}
diff --git a/tests/bugs154/pr211052/SimpleAspect2.java b/tests/bugs154/pr211052/SimpleAspect2.java
new file mode 100644 (file)
index 0000000..f3438d5
--- /dev/null
@@ -0,0 +1,8 @@
+package a.b;
+
+import c.d.DistantResource;
+
+// import target type
+aspect SimpleAspect1 {
+  declare @type: DistantResource: @SimpleAnnotation(classname="oranges");
+}
diff --git a/tests/bugs154/pr211052/SimpleAspect3.java b/tests/bugs154/pr211052/SimpleAspect3.java
new file mode 100644 (file)
index 0000000..e085908
--- /dev/null
@@ -0,0 +1,6 @@
+package a.b;
+
+// fully qualified reference to annotation type
+aspect SimpleAspect3 {
+  declare @type: c.d.DistantResource: @e.f.SimpleAnnotation2(classname="oranges");
+}
diff --git a/tests/bugs154/pr211052/SimpleAspect4.java b/tests/bugs154/pr211052/SimpleAspect4.java
new file mode 100644 (file)
index 0000000..a8812e0
--- /dev/null
@@ -0,0 +1,9 @@
+package a.b;
+
+import c.d.DistantResource;
+import e.f.SimpleAnnotation2;
+
+// import the annotation type
+aspect SimpleAspect4 {
+  declare @type: DistantResource: @SimpleAnnotation2(classname="oranges");
+}