Inconsistency in scoping of protected members in ITDstags/V1_2_1
@@ -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(); | |||
} | |||
} | |||
@@ -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; } | |||
} |
@@ -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"); | |||
} | |||
} | |||
@@ -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> |