mirror of
https://github.com/eclipse-aspectj/aspectj.git
synced 2024-08-27 05:54:38 +02:00
6ddae42579
Advice calling protected super method causing java.lang.VerifyError 'Bad access to protected data' Also expanded test to cover protected field access as well as methods Fix required getting the correct receiver type for both field access and method calls to correspond to Java's complicated rules for accessing protected members (JLSv2 6.6.2 and mentioned in passing in JVMv2 5.4.4)
25 lines
773 B
Plaintext
25 lines
773 B
Plaintext
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.*/
|
|
ConcreteTest ct = this;
|
|
System.out.println("test: " + s + ", " + this.s + ", " + ct.s);
|
|
System.out.println("The value of the field when replacing is " + getField());
|
|
return proceed();
|
|
}
|
|
|
|
protected void hook() {
|
|
/*This doesn't cause a verify error because this code is not inlined*/
|
|
System.out.println("The value of the field is " + getField());
|
|
}
|
|
} |