From 6beb43faeecff249a33e7d7e2489c6a92a4700fd Mon Sep 17 00:00:00 2001 From: aclement Date: Tue, 19 Oct 2004 10:37:31 +0000 Subject: Fix for Bugzilla Bug 76096: Anonymous classes unaware of introductions into abstract classes (error can't find type $Local$) --- tests/bugs/pr76096/ConcreteClassA.java | 50 ++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 tests/bugs/pr76096/ConcreteClassA.java (limited to 'tests/bugs/pr76096') diff --git a/tests/bugs/pr76096/ConcreteClassA.java b/tests/bugs/pr76096/ConcreteClassA.java new file mode 100644 index 000000000..77bbb9ee6 --- /dev/null +++ b/tests/bugs/pr76096/ConcreteClassA.java @@ -0,0 +1,50 @@ +// In the ConcreteClassA.someMethod() method, the creation of the anonymous class should +// be ok as the ITD ensures that InterfaceA.a2() is implemented. + +interface InterfaceA { + public void a1(); + public void a2(); +} + +abstract class AbstractClassA implements InterfaceA { + public void a1() { + System.out.println("AbstractClassA.a()"); + } +} + +public class ConcreteClassA extends AbstractClassA { + public void someMethod() { + InterfaceA a = new AbstractClassA() { }; + a.a2(); + } + + public static void main(String[]argv) { + new ConcreteClassA().someMethod(); + new concCB().someMethod(); + } +} + +aspect IntroAspectA { + public void AbstractClassA.a2() { + System.out.println("AbstractClassA.a2() from IntroAspectA"); + } +} + +interface IB { + public void m2(); +} + +abstract class absCB implements IB { + public void m1() { } +} + +class concCB extends absCB { + public void someMethod() { + IB b = new IB() {}; + b.m2(); + } +} + +aspect introAspectB { + public void IB.m2() {System.err.println("absCB.m1() from IB");} +} -- cgit v1.2.3