Bug 6719 - LocalTypeDeclaration::traverse
Summary: LocalTypeDeclaration::traverse
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.0   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: 2.0 M2   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2001-12-10 06:51 EST by Adam Kiezun CLA
Modified: 2002-01-11 08:56 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Adam Kiezun CLA 2001-12-10 06:51:48 EST
not sure if it's a bug:
method LocalTypeDeclaraion::traverse(IAbstractSyntaxTreeVisitor visitor, 
BlockScope blockScope)

calls visitor.visit(this, blockScope)

however, this does not call visit(LocalTypeDeclaration, MethodScope) on the 
visitor (as i expected) - exactly because the best match for the call is 
visit(TypeDeclaration, BlockScope)


not sure if it's clear what i mean: 'this' is statically resolved to 
LocalTypeDeclaration so i thought the visit method should be called for 
LocalTypeDeclaration.

the problem is a missing instanceof check on the blockScope - it is is 
instanceof MethodScope then another method should be called.

am i correct that it is a bug?
Comment 1 Olivier Thomann CLA 2001-12-11 14:27:51 EST
You are right. The visit(LocalTypeDeclaration, MethodScope) should be called in 
the traverse. We can either add a cast or change the Visitor API to use 
BlockScope instead of MethodScope.
Comment 2 Olivier Thomann CLA 2001-12-11 15:39:17 EST
Changing the call to add the cast breaks a test in the SearchTests. I asked 
Jérôme to have a look at it. It might be a bug in the MatchLocatorParser due to 
the wrong call in the traverse.
Jérôme, could you please annotate this PR when you check the MatchLocatorParser 
implementation?

Comment 3 Jerome Lanneluc CLA 2001-12-11 18:33:29 EST
I think the problem is more with the indexing. Looking at 
SourceElementParser.LocalDeclarationVistor, I see that it redefines 3 visit 
methods, none of them taking a MethodScope in its parameter.
Comment 4 Olivier Thomann CLA 2001-12-14 12:32:03 EST
Changes released in HEAD. Please ensure that code using the visitor is released 
as well in the next integration build. It should be done according to your 
email.