diff options
author | jhugunin <jhugunin> | 2004-02-19 22:09:16 +0000 |
---|---|---|
committer | jhugunin <jhugunin> | 2004-02-19 22:09:16 +0000 |
commit | 6ddae42579ceb781831e08f0fcf77a4ff4ffb5c0 (patch) | |
tree | 466c3b3a790f56c4985cbb78686342abe3447591 /tests | |
parent | 669cd7ce8634623c004cca5732c94a20fd7f57f7 (diff) | |
download | aspectj-6ddae42579ceb781831e08f0fcf77a4ff4ffb5c0.tar.gz aspectj-6ddae42579ceb781831e08f0fcf77a4ff4ffb5c0.zip |
fix for Bugzilla Bug 51929
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)
Diffstat (limited to 'tests')
-rw-r--r-- | tests/ajcTests.xml | 6 | ||||
-rw-r--r-- | tests/ajcTestsFailing.xml | 6 | ||||
-rw-r--r-- | tests/bugs/protectedvf/main/Driver.java | 4 | ||||
-rw-r--r-- | tests/bugs/protectedvf/main/p1/ConcreteTest.aj | 6 | ||||
-rw-r--r-- | tests/bugs/protectedvf/main/p2/AbstractTest.aj | 2 |
5 files changed, 14 insertions, 10 deletions
diff --git a/tests/ajcTests.xml b/tests/ajcTests.xml index 4f68d8e00..ded12e25e 100644 --- a/tests/ajcTests.xml +++ b/tests/ajcTests.xml @@ -7172,4 +7172,10 @@ <compile files="TraceWithInnerV2.aj"/> <run class="Main"/> </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/ajcTestsFailing.xml b/tests/ajcTestsFailing.xml index 33a3a5d14..cd8ba3e47 100644 --- a/tests/ajcTestsFailing.xml +++ b/tests/ajcTestsFailing.xml @@ -133,12 +133,6 @@ <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> - <ajc-test dir="bugs/fieldsOnInterfaces" pr="52107" title="declare String field on interface"> diff --git a/tests/bugs/protectedvf/main/Driver.java b/tests/bugs/protectedvf/main/Driver.java index 6590760eb..5ca85cd32 100644 --- a/tests/bugs/protectedvf/main/Driver.java +++ b/tests/bugs/protectedvf/main/Driver.java @@ -9,10 +9,10 @@ public class Driver{ } private void doOtherStuff() { - System.out.println("doing other stuff"); + //System.out.println("doing other stuff"); } private void doStuff() { - System.out.println("doing stuff"); + //System.out.println("doing stuff"); } } diff --git a/tests/bugs/protectedvf/main/p1/ConcreteTest.aj b/tests/bugs/protectedvf/main/p1/ConcreteTest.aj index be044e544..26f213b0c 100644 --- a/tests/bugs/protectedvf/main/p1/ConcreteTest.aj +++ b/tests/bugs/protectedvf/main/p1/ConcreteTest.aj @@ -10,14 +10,16 @@ final aspect ConcreteTest extends AbstractTest { protected pointcut pc2(): execution(* Driver.doOtherStuff());
Object around(): pc2() {
- System.out.println("adding to the other stuff");
+ //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 seemably because the advice calling it is in AbstractTest*/
+ /*This doesn't cause a verify error because this code is not inlined*/
System.out.println("The value of the field is " + getField());
}
}
\ No newline at end of file diff --git a/tests/bugs/protectedvf/main/p2/AbstractTest.aj b/tests/bugs/protectedvf/main/p2/AbstractTest.aj index 0c8b040c4..748af744d 100644 --- a/tests/bugs/protectedvf/main/p2/AbstractTest.aj +++ b/tests/bugs/protectedvf/main/p2/AbstractTest.aj @@ -3,11 +3,13 @@ package main.p2; public abstract aspect AbstractTest {
private int field;
+ protected String s = "test";
protected abstract pointcut pc();
Object around(): pc() {
this.field++;
+ s += "-1";
hook();
return proceed();
}
|