]> source.dussan.org Git - aspectj.git/commitdiff
testcode for 145391,145693
authoraclement <aclement>
Wed, 7 Jun 2006 08:19:14 +0000 (08:19 +0000)
committeraclement <aclement>
Wed, 7 Jun 2006 08:19:14 +0000 (08:19 +0000)
tests/bugs152/pr145391/GenericType.java [new file with mode: 0644]
tests/bugs152/pr145391/GenericType2.java [new file with mode: 0644]
tests/bugs152/pr145693/Event.java [new file with mode: 0644]
tests/bugs152/pr145693/Monitor.aj [new file with mode: 0644]
tests/bugs152/pr145693/Sample.java [new file with mode: 0644]

diff --git a/tests/bugs152/pr145391/GenericType.java b/tests/bugs152/pr145391/GenericType.java
new file mode 100644 (file)
index 0000000..897e1b7
--- /dev/null
@@ -0,0 +1,38 @@
+public class GenericType<V extends Integer> {
+
+        public GenericType(V value) {}
+
+        public void foo() {}
+//
+//        public void bar() {}
+
+        protected V getValue() {
+                return null;
+        }
+
+        public static void main(String[] args) {
+                new GenericType<Integer>(null).foo();
+        }
+
+}
+
+aspect SomeAspect {
+        before(GenericType t): call(* GenericType.foo()) && target(t) {
+                // Direct call to non-generic method works
+//                t.bar();
+                // Indirect call to non-generic method works
+//                t.callNormalMethod();
+                // Direct call to generic method works
+//                t.getValue();
+                // Indirect call to generic method produces a NoSuchMethodError
+                t.callGenericMethod();
+        }
+
+//        private void GenericType.callNormalMethod() {
+//                bar();
+//        }
+
+        private void GenericType.callGenericMethod() {
+                getValue();
+        }
+}
\ No newline at end of file
diff --git a/tests/bugs152/pr145391/GenericType2.java b/tests/bugs152/pr145391/GenericType2.java
new file mode 100644 (file)
index 0000000..c5c6ab3
--- /dev/null
@@ -0,0 +1,37 @@
+public class GenericType2<V extends Integer> {
+
+        public GenericType2(V value) {}
+
+        public void foo() {}
+//
+//        public void bar() {}
+
+        protected void getValue(V aV) {
+        }
+
+        public static void main(String[] args) {
+                new GenericType2<Integer>(null).foo();
+        }
+
+}
+
+aspect SomeAspect {
+        before(GenericType2 t): call(* GenericType2.foo()) && target(t) {
+                // Direct call to non-generic method works
+//                t.bar();
+                // Indirect call to non-generic method works
+//                t.callNormalMethod();
+                // Direct call to generic method works
+//                t.getValue();
+                // Indirect call to generic method produces a NoSuchMethodError
+                t.callGenericMethod();
+        }
+
+//        private void GenericType.callNormalMethod() {
+//                bar();
+//        }
+
+        private void GenericType2.callGenericMethod() {
+                getValue(new Integer(45));
+        }
+}
\ No newline at end of file
diff --git a/tests/bugs152/pr145693/Event.java b/tests/bugs152/pr145693/Event.java
new file mode 100644 (file)
index 0000000..e2a8b62
--- /dev/null
@@ -0,0 +1 @@
+public class Event {}
diff --git a/tests/bugs152/pr145693/Monitor.aj b/tests/bugs152/pr145693/Monitor.aj
new file mode 100644 (file)
index 0000000..51b3785
--- /dev/null
@@ -0,0 +1,12 @@
+public aspect Monitor {
+    public pointcut handleEvent(Event event):
+        execution(* handleEvent(Event, ..)) && args(event);
+    
+    public pointcut inHandleEvent(Event event): cflow(handleEvent(event));
+
+    before(Event event): 
+               set(* currentView) && 
+               inHandleEvent(event) {
+       }
+    
+}
diff --git a/tests/bugs152/pr145693/Sample.java b/tests/bugs152/pr145693/Sample.java
new file mode 100644 (file)
index 0000000..50f9cb3
--- /dev/null
@@ -0,0 +1,9 @@
+public class Sample {
+
+    private static Object currentView;
+
+    public static void main(String args[]) {
+        currentView = "test";
+    }
+
+}