<run class="main.Driver"/>
</ajc-test>
+ <ajc-test dir="bugs/fieldsOnInterfaces"
+ pr="52107"
+ title="declare String field on interface">
+ <compile files="StringFieldOnInterface.java"/>
+ <run class="StringFieldOnInterface"/>
+ </ajc-test>
+
+ <ajc-test dir="bugs/fieldsOnInterfaces"
+ pr="52107"
+ title="declare int field on interface">
+ <compile files="IntFieldOnInterface.java"/>
+ <run class="IntFieldOnInterface"/>
+ </ajc-test>
+
+ <ajc-test dir="bugs/fieldsOnInterfaces"
+ pr="52107"
+ title="declare Object field on interface">
+ <compile files="ObjectFieldOnInterface.java"/>
+ <run class="ObjectFieldOnInterface"/>
+ </ajc-test>
+
</suite>
--- /dev/null
+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
--- /dev/null
+
+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
--- /dev/null
+
+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