fix for Bugzilla Bug 71723

Inconsistency in scoping of protected members in ITDs
This commit is contained in:
acolyer 2004-08-18 12:39:40 +00:00
parent 5b902242b0
commit dfb15c1777
6 changed files with 67 additions and 1 deletions

View File

@ -0,0 +1,36 @@
package bar;
import foo.Foo;
aspect Bar {
public void Foo.doing() {
try {
System.out.println(i()); // CE L8
System.out.println(ancientI()); // CE L9
System.out.println(ancientJ()); // CE L10
System.out.println(this.clone()); // CE L11
System.out.println(clone()); // CE L12
}
catch(Throwable t) { }
}
before(Foo f) : call(* doStuff(..)) && target(f) {
f.doing();
}
}
privileged aspect PBar {
public void Foo.doingMore() {
try {
System.out.println(i());
System.out.println(ancientI());
System.out.println(ancientJ());
}
catch(Throwable t) { }
}
before(Foo f) : call(* doStuff(..)) && target(f) {
f.doing();
}
}

View File

@ -0,0 +1,17 @@
package foo;
public class Foo extends AncientFoo {
protected int i() { return 42; }
public static void main(String[] args) {
new Foo().doStuff();
}
public void doStuff() { }
protected int ancientI() { return 42; }
}
class AncientFoo {
protected int ancientI() { return -42; }
protected int ancientJ() { return 0; }
}

View File

@ -236,10 +236,13 @@ public class Ajc121Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
// s.indexOf("CAUSE=org.aspectj.lang.NoAspectBoundException")!=-1);
}
public void test044_ITDnameClashes() {
runTest("ITD name clashes with private members");
}
public void test045_ITDprotectedVisibility() {
runTest("Inconsistency in scoping of protected members in ITDs");
}
}

View File

@ -345,3 +345,13 @@
</compile>
</ajc-test>
<ajc-test dir="bugs/pr71723" pr="71723"
title="Inconsistency in scoping of protected members in ITDs">
<compile files="foo/Foo.java,bar/Bar.aj">
<message kind="error" line="8" text="The method i() from the type Foo is not visible"/>
<message kind="error" line="9" text="The method ancientI() from the type Foo is not visible"/>
<message kind="error" line="10" text="The method ancientJ() from the type AncientFoo is not visible"/>
<message kind="error" line="11" text="The method clone() from the type Object is not visible"/>
<message kind="error" line="12" text="The method clone() from the type Object is not static"/>
</compile>
</ajc-test>