aboutsummaryrefslogtreecommitdiffstats
path: root/tests/bugs
diff options
context:
space:
mode:
authorwisberg <wisberg>2004-02-15 19:13:41 +0000
committerwisberg <wisberg>2004-02-15 19:13:41 +0000
commit0d5ebc4e81463bf918585ebeaf4a3e01ab3db3ad (patch)
treeca198137765dfbaeeb72a4d330df5afa28ff5984 /tests/bugs
parent95f2f555025370059b4acdb9aca17b9db3b640a0 (diff)
downloadaspectj-0d5ebc4e81463bf918585ebeaf4a3e01ab3db3ad.tar.gz
aspectj-0d5ebc4e81463bf918585ebeaf4a3e01ab3db3ad.zip
@testcase PR#52107 declare [int | String | Object] field on interface
Diffstat (limited to 'tests/bugs')
-rw-r--r--tests/bugs/fieldsOnInterfaces/IntFieldOnInterface.java37
-rw-r--r--tests/bugs/fieldsOnInterfaces/ObjectFieldOnInterface.java24
-rw-r--r--tests/bugs/fieldsOnInterfaces/StringFieldOnInterface.java21
3 files changed, 82 insertions, 0 deletions
diff --git a/tests/bugs/fieldsOnInterfaces/IntFieldOnInterface.java b/tests/bugs/fieldsOnInterfaces/IntFieldOnInterface.java
new file mode 100644
index 000000000..9d9f7e205
--- /dev/null
+++ b/tests/bugs/fieldsOnInterfaces/IntFieldOnInterface.java
@@ -0,0 +1,37 @@
+import org.aspectj.testing.Tester;
+
+/** @testcase PR#52107 declare int field on interface */
+public class IntFieldOnInterface implements Runnable {
+ public static final int caseid = 2;
+ public static void main(String[] args) {
+ Tester.expectEvent("A name=2");
+ Tester.expectEvent("R name=2");
+ IntFieldOnInterface test
+ = new IntFieldOnInterface();
+ test.run();
+ test.blah();
+ Tester.checkAllEvents();
+ }
+ public void run() {
+ switch (name) {
+ case (IntFieldOnInterface.caseid) :
+ Tester.event("R name=" + name);
+ break;
+ default :
+ throw new Error("bad switch");
+ }
+ }
+}
+
+aspect A {
+ public int Runnable.name = IntFieldOnInterface.caseid;
+ public void Runnable.blah() {
+ switch (name) {
+ case (IntFieldOnInterface.caseid) :
+ Tester.event("A name=" + name);
+ break;
+ default :
+ throw new Error("bad switch");
+ }
+ }
+} \ No newline at end of file
diff --git a/tests/bugs/fieldsOnInterfaces/ObjectFieldOnInterface.java b/tests/bugs/fieldsOnInterfaces/ObjectFieldOnInterface.java
new file mode 100644
index 000000000..0bc84acf9
--- /dev/null
+++ b/tests/bugs/fieldsOnInterfaces/ObjectFieldOnInterface.java
@@ -0,0 +1,24 @@
+
+import org.aspectj.testing.Tester;
+
+/** @testcase PR#52107 declare Object field on interface */
+public class ObjectFieldOnInterface implements Runnable {
+ public static void main(String[] args) {
+ Tester.expectEvent("class(A): java.lang.Object");
+ Tester.expectEvent("class(R): java.lang.Object");
+ ObjectFieldOnInterface test
+ = new ObjectFieldOnInterface();
+ test.blah();
+ Tester.event("class(R): " + test.object.getClass().getName());
+ Tester.checkAllEvents();
+ }
+ public void run() {
+ }
+}
+
+aspect A {
+ public Object Runnable.object = new Object();
+ public void Runnable.blah() {
+ Tester.event("class(A): " + object.getClass().getName());
+ }
+} \ No newline at end of file
diff --git a/tests/bugs/fieldsOnInterfaces/StringFieldOnInterface.java b/tests/bugs/fieldsOnInterfaces/StringFieldOnInterface.java
new file mode 100644
index 000000000..5f4a3c528
--- /dev/null
+++ b/tests/bugs/fieldsOnInterfaces/StringFieldOnInterface.java
@@ -0,0 +1,21 @@
+
+import org.aspectj.testing.Tester;
+
+/** @testcase PR#52107 declare String field on interface */
+public class StringFieldOnInterface implements Runnable {
+ public static void main(String[] args) {
+ Tester.expectEvent("length=1");
+ new StringFieldOnInterface().blah();
+ Tester.checkAllEvents();
+ }
+ public void run() {
+ }
+}
+
+aspect A {
+ public String Runnable.name = "a";
+ public void Runnable.blah() {
+ int i = name.length();
+ Tester.event("length="+i);
+ }
+} \ No newline at end of file