]> source.dussan.org Git - aspectj.git/commitdiff
mailing list verify error
authorwisberg <wisberg>
Fri, 13 Feb 2004 01:21:03 +0000 (01:21 +0000)
committerwisberg <wisberg>
Fri, 13 Feb 2004 01:21:03 +0000 (01:21 +0000)
tests/ajcTestsFailing.xml
tests/bugs/protectedvf/main/Driver.java [new file with mode: 0644]
tests/bugs/protectedvf/main/p1/ConcreteTest.aj [new file with mode: 0644]
tests/bugs/protectedvf/main/p2/AbstractTest.aj [new file with mode: 0644]

index c2fb46b054957ea5becf0e41505d18a491820f82..27079b95ddafa3a39d24b17e233e7b5cd5dd9621 100644 (file)
         <run class="InterfaceInitializerOrder"/>
     </ajc-test>
 
+       <ajc-test dir="bugs/protectedvf"
+               title="mail list VerifyError with protected access">
+               <compile files="main/Driver.java,main/p2/AbstractTest.aj,main/p1/ConcreteTest.aj"/>
+               <run class="main.Driver"/>
+               </ajc-test>
+
 </suite>
diff --git a/tests/bugs/protectedvf/main/Driver.java b/tests/bugs/protectedvf/main/Driver.java
new file mode 100644 (file)
index 0000000..6590760
--- /dev/null
@@ -0,0 +1,18 @@
+package main;
+
+public class Driver{
+
+       public static void main(String[] args) {
+               Driver d = new Driver();
+               d.doStuff();
+               d.doOtherStuff();
+       }
+
+       private void doOtherStuff() {
+               System.out.println("doing other stuff");
+       }
+
+       private void doStuff() {
+               System.out.println("doing stuff");
+       }
+}
diff --git a/tests/bugs/protectedvf/main/p1/ConcreteTest.aj b/tests/bugs/protectedvf/main/p1/ConcreteTest.aj
new file mode 100644 (file)
index 0000000..be044e5
--- /dev/null
@@ -0,0 +1,23 @@
+package main.p1;\r
+\r
+import main.p2.AbstractTest;\r
+import main.Driver;\r
+\r
+final aspect ConcreteTest extends AbstractTest {\r
+\r
+       protected pointcut pc(): execution(* Driver.doStuff());\r
+\r
+       protected pointcut pc2(): execution(* Driver.doOtherStuff());\r
+\r
+       Object around(): pc2() {\r
+               System.out.println("adding to the other stuff");\r
+               /*If we comment out the next line we don't get a verify error.*/\r
+               System.out.println("The value of the field when replacing is " + getField());\r
+               return proceed();\r
+       }\r
+\r
+       protected void hook() {\r
+               /*This doesn't cause a verify error seemably because the advice calling it is in AbstractTest*/\r
+               System.out.println("The value of the field is " + getField());\r
+       }\r
+}
\ No newline at end of file
diff --git a/tests/bugs/protectedvf/main/p2/AbstractTest.aj b/tests/bugs/protectedvf/main/p2/AbstractTest.aj
new file mode 100644 (file)
index 0000000..0c8b040
--- /dev/null
@@ -0,0 +1,20 @@
+package main.p2;\r
+\r
+public abstract aspect AbstractTest {\r
+\r
+       private int field;\r
+\r
+       protected abstract pointcut pc();\r
+\r
+       Object around(): pc() {\r
+               this.field++;\r
+               hook();\r
+               return proceed();\r
+       }\r
+\r
+       protected final int getField() {\r
+               return this.field;\r
+       }\r
+\r
+       protected abstract void hook();\r
+}
\ No newline at end of file