diff options
author | aclement <aclement> | 2004-11-30 17:43:50 +0000 |
---|---|---|
committer | aclement <aclement> | 2004-11-30 17:43:50 +0000 |
commit | 4d1c2948a2f18012cd49dbe8e3a32b1a863d4d45 (patch) | |
tree | 46a5c36fc674dba59ee56f88e38f1e9d8296a345 /tests/java5/bridgeMethods/AspectX.aj | |
parent | cc251667ab8afaad4809643ea3760fe17e9c5607 (diff) | |
download | aspectj-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.aj | 33 |
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);
+ }
+ }
+}
|