aboutsummaryrefslogtreecommitdiffstats
path: root/tests/java5/bridgeMethods
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
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')
-rw-r--r--tests/java5/bridgeMethods/AspectX.aj33
-rw-r--r--tests/java5/bridgeMethods/Comparable.java3
-rw-r--r--tests/java5/bridgeMethods/Number.java6
-rw-r--r--tests/java5/bridgeMethods/build.xml11
-rw-r--r--tests/java5/bridgeMethods/testcode.jarbin0 -> 799 bytes
5 files changed, 53 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);
+ }
+ }
+}
diff --git a/tests/java5/bridgeMethods/Comparable.java b/tests/java5/bridgeMethods/Comparable.java
new file mode 100644
index 000000000..0236945e2
--- /dev/null
+++ b/tests/java5/bridgeMethods/Comparable.java
@@ -0,0 +1,3 @@
+interface Comparable<A> {
+ public int compareTo(A that);
+}
diff --git a/tests/java5/bridgeMethods/Number.java b/tests/java5/bridgeMethods/Number.java
new file mode 100644
index 000000000..1a866ec19
--- /dev/null
+++ b/tests/java5/bridgeMethods/Number.java
@@ -0,0 +1,6 @@
+public class Number implements Comparable<Number> {
+ private int i;
+ public Number(int i) { this.i = i; }
+ public int getValue() { return i;}
+ public int compareTo(Number that) { return this.getValue() - that.getValue(); }
+}
diff --git a/tests/java5/bridgeMethods/build.xml b/tests/java5/bridgeMethods/build.xml
new file mode 100644
index 000000000..7170813dc
--- /dev/null
+++ b/tests/java5/bridgeMethods/build.xml
@@ -0,0 +1,11 @@
+<project name="Java 5 compilation of test source" default="default" basedir=".">
+
+ <target name="default">
+ <delete dir="output" failonerror="false"/>
+ <mkdir dir="output"/>
+ <javac destdir="output" debug="on" srcdir="." includes="*.java"/>
+ <zip file="testcode.jar" basedir="output" includes="*"/>
+ <delete dir="output"/>
+ </target>
+
+</project>
diff --git a/tests/java5/bridgeMethods/testcode.jar b/tests/java5/bridgeMethods/testcode.jar
new file mode 100644
index 000000000..f543454b0
--- /dev/null
+++ b/tests/java5/bridgeMethods/testcode.jar
Binary files differ