@@ -133,4 +133,10 @@ | |||
<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> |
@@ -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"); | |||
} | |||
} |
@@ -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()); | |||
} | |||
} |
@@ -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(); | |||
} |