Community
Participate
Working Groups
The example below generates a compiler error, on both Linux and Windows. The error occurs for ajdt (eclipse) as well. The compiler error: $ ajc -version > AspectJ Compiler 1.2 built on Friday May 21, 2004 at > 15:06:22 GMT > $ ajc ConcreteClassA.java > error can't find type $Local$ > > /home/marin/tests/ConcreteClassA.java:18 error Class > must implement the inherited abstract method > InterfaceA.a2() > InterfaceA a = new AbstractClassA() { > ^^^^^^^^^^^^^ > > 2 errors > -------- > The example (in ConcreteClassA.java): 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() { }; } } aspect IntroAspectA { public void AbstractClassA.a2() { System.out.println("AbstractClassA.a2() from IntroAspectA"); } } ------------ If you comment out the body of someMethod() (the anonymous class), the code compiles without errors.
This was a problem in the AjProblemReporter code. Before putting out the error it checks if an ITD exists that would resolve the issue. It used to attempt to resolve the type for the generated class that represented the anonymous type ($Local$) - this obviously fails. It now allows for anonymous types and checks for ITDs on the parent of the anonymous type. Tests added, fixed checked in. Will close when build available.
Fix available. BUILD COMPLETE - build.385 Date of build: 10/19/2004 15:08:44 Time to build: 230 minutes 55 seconds Last changed: 10/19/2004 11:37:35 Last log entry: Fix for Bugzilla Bug 76096: Anonymous classes unaware of introductions into abstract classes (error can't find type $Local$) Latest good AspectJ jar available at: download.eclipse.org/technology/ajdt/dev/aspectj-DEVELOPMENT.jar
Fix released as part of AspectJ 1.2.1