Bug 107486 - Anonymous inner class results in "can't find type $Local$"
Summary: Anonymous inner class results in "can't find type $Local$"
Status: RESOLVED FIXED
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: DEVELOPMENT   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Adrian Colyer CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-08-19 17:44 EDT by Vincent Jorrand CLA
Modified: 2005-08-25 03:28 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Vincent Jorrand CLA 2005-08-19 17:44:24 EDT
the following class results in "can't find type $Local$" in the problem view,
with the latest (1.3.0.20050819153037 for Eclipse 3.1) build.


public class A {
    public Object f() {
        return new Object() {
            public String toString() {
                return "f";
            }
        };
    }
}

I created an AspectJ project with only this class in it.
It only causes that problem if the project is an AspectJ project, not in a Java
project.
The problem sometimes disappears when editing the file, in that case cleaning
the project makes it come back. For example, one way to make it disappear is to
remove the toString() method, save (error disappear), put the method back (still
no error), clean the project (error is back).
Comment 1 Andrew Clement CLA 2005-08-22 06:37:02 EDT
This happens with the latest command line compiler *only* if you compile it with
-emacssym (which mimics building the structure model, which AJDT always wants)

ajc -emacssym -1.5 A.java

The stack trace from the ASM builder to the problem is as follows:

BcelWorld(World).handleRequiredMissingTypeDuringResolution(UnresolvedType) line: 219
BcelWorld(World).resolve(UnresolvedType, boolean) line: 204
BcelWorld(World).resolve(UnresolvedType) line: 124
EclipseFactory.makeResolvedMember(MethodBinding, TypeBinding) line: 419
EclipseFactory.makeResolvedMember(MethodBinding) line: 391
AsmHierarchyBuilder.genBytecodeInfo(MethodDeclaration, IProgramElement) line: 501
AsmHierarchyBuilder.visit(MethodDeclaration, ClassScope) line: 376
AjMethodDeclaration(MethodDeclaration).traverse(ASTVisitor, ClassScope) line: 185
TypeDeclaration.traverse(ASTVisitor, BlockScope) line: 1238
QualifiedAllocationExpression.traverse(ASTVisitor, BlockScope) line: 392
ReturnStatement.traverse(ASTVisitor, BlockScope) line: 222
AjMethodDeclaration(MethodDeclaration).traverse(ASTVisitor, ClassScope) line: 212
TypeDeclaration.traverse(ASTVisitor, CompilationUnitScope) line: 1183
CompilationUnitDeclaration.traverse(ASTVisitor, CompilationUnitScope) line: 339
AsmHierarchyBuilder.internalBuild(CompilationUnitDeclaration, IHierarchy) line: 142
AsmHierarchyBuilder.buildStructureForCompilationUnit(CompilationUnitDeclaration,
IHierarchy, AjBuildConfig) line: 82

Note, this also affects us building our shadows copy of the JDT compiler.
Comment 2 Matt Chapman CLA 2005-08-22 07:52:11 EDT
This also affects the Spacewar sample, when the debug configuration is used.
Comment 3 Adrian Colyer CLA 2005-08-24 11:06:13 EDT
I've commited the fix for this bug. It will be available in the next published
AspectJ build, and AJDT will be then be able to pick up and incorporate a new
ajde....
Comment 4 Andrew Clement CLA 2005-08-24 13:53:48 EDT
i've checked the fixed version into AJDT cvs.
Comment 5 Andrew Clement CLA 2005-08-25 03:28:35 EDT
fix available.