Bug 76096 - Anonymous classes unaware of introductions into abstract classes (error can't find type $Local$)
Summary: Anonymous classes unaware of introductions into abstract classes (error can't...
Status: RESOLVED FIXED
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: 1.2   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 1.2.1   Edit
Assignee: Adrian Colyer CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-10-12 12:17 EDT by Marius Marin CLA
Modified: 2004-10-21 04:30 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Marius Marin CLA 2004-10-12 12:17:35 EDT
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.
Comment 1 Andrew Clement CLA 2004-10-19 06:49:53 EDT
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.
Comment 2 Andrew Clement CLA 2004-10-20 03:58:33 EDT
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
Comment 3 Adrian Colyer CLA 2004-10-21 04:30:55 EDT
Fix released as part of AspectJ 1.2.1