mirror of
https://github.com/eclipse-aspectj/aspectj.git
synced 2024-08-27 17:54:40 +02:00
mailing list verify error
This commit is contained in:
parent
8555cabe0c
commit
95f2f55502
@ -133,4 +133,10 @@
|
|||||||
<run class="InterfaceInitializerOrder"/>
|
<run class="InterfaceInitializerOrder"/>
|
||||||
</ajc-test>
|
</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>
|
</suite>
|
||||||
|
18
tests/bugs/protectedvf/main/Driver.java
Normal file
18
tests/bugs/protectedvf/main/Driver.java
Normal file
@ -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");
|
||||||
|
}
|
||||||
|
}
|
23
tests/bugs/protectedvf/main/p1/ConcreteTest.aj
Normal file
23
tests/bugs/protectedvf/main/p1/ConcreteTest.aj
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
package main.p1;
|
||||||
|
|
||||||
|
import main.p2.AbstractTest;
|
||||||
|
import main.Driver;
|
||||||
|
|
||||||
|
final aspect ConcreteTest extends AbstractTest {
|
||||||
|
|
||||||
|
protected pointcut pc(): execution(* Driver.doStuff());
|
||||||
|
|
||||||
|
protected pointcut pc2(): execution(* Driver.doOtherStuff());
|
||||||
|
|
||||||
|
Object around(): pc2() {
|
||||||
|
System.out.println("adding to the other stuff");
|
||||||
|
/*If we comment out the next line we don't get a verify error.*/
|
||||||
|
System.out.println("The value of the field when replacing is " + getField());
|
||||||
|
return proceed();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void hook() {
|
||||||
|
/*This doesn't cause a verify error seemably because the advice calling it is in AbstractTest*/
|
||||||
|
System.out.println("The value of the field is " + getField());
|
||||||
|
}
|
||||||
|
}
|
20
tests/bugs/protectedvf/main/p2/AbstractTest.aj
Normal file
20
tests/bugs/protectedvf/main/p2/AbstractTest.aj
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
package main.p2;
|
||||||
|
|
||||||
|
public abstract aspect AbstractTest {
|
||||||
|
|
||||||
|
private int field;
|
||||||
|
|
||||||
|
protected abstract pointcut pc();
|
||||||
|
|
||||||
|
Object around(): pc() {
|
||||||
|
this.field++;
|
||||||
|
hook();
|
||||||
|
return proceed();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected final int getField() {
|
||||||
|
return this.field;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected abstract void hook();
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user