summaryrefslogtreecommitdiffstats
path: root/tests/java5/bridgeMethods/AspectX.aj
diff options
context:
space:
mode:
authoraclement <aclement>2004-11-30 17:43:50 +0000
committeraclement <aclement>2004-11-30 17:43:50 +0000
commit4d1c2948a2f18012cd49dbe8e3a32b1a863d4d45 (patch)
tree46a5c36fc674dba59ee56f88e38f1e9d8296a345 /tests/java5/bridgeMethods/AspectX.aj
parentcc251667ab8afaad4809643ea3760fe17e9c5607 (diff)
downloadaspectj-4d1c2948a2f18012cd49dbe8e3a32b1a863d4d45.tar.gz
aspectj-4d1c2948a2f18012cd49dbe8e3a32b1a863d4d45.zip
Part of 72766: Bridge methods - we now do the right thing if we see one (i.e. we ignore it as a source of join points)
Diffstat (limited to 'tests/java5/bridgeMethods/AspectX.aj')
-rw-r--r--tests/java5/bridgeMethods/AspectX.aj33
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/java5/bridgeMethods/AspectX.aj b/tests/java5/bridgeMethods/AspectX.aj
new file mode 100644
index 000000000..fb4827023
--- /dev/null
+++ b/tests/java5/bridgeMethods/AspectX.aj
@@ -0,0 +1,33 @@
+import java.util.*;
+
+public aspect AspectX {
+
+ static Set matchedJps = new HashSet();
+
+ before(): call(* compareTo(..)) {
+ matchedJps.add(new String("call() matched on "+thisJoinPoint.toString()));
+ }
+
+ before(): execution(* compareTo(..)) {
+ matchedJps.add(new String("execution() matched on "+thisJoinPoint.toString()));
+ }
+
+ public static void main(String []argv) {
+ Number n1 = new Number(5);
+ Number n2 = new Number(7);
+ n1.compareTo(n2);
+ n1.compareTo("abc"); // A Java5 compiler would *not* allow this, a call to a bridge method: error should be:
+ /**
+ AspectX.java:19: compareTo(Number) in Number cannot be applied to (java.lang.String)
+ n1.compareTo("abc");
+ ^
+ 1 error
+ */
+
+ Iterator i = matchedJps.iterator();
+ while (i.hasNext()) {
+ String s = (String)i.next();
+ System.err.println(s);
+ }
+ }
+}