Bug 6957 - CCE in AnonymousLocalTypeDeclaration::traverse
Summary: CCE in AnonymousLocalTypeDeclaration::traverse
Status: CLOSED INVALID
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.0   Edit
Hardware: PC Windows 2000
: P3 major (vote)
Target Milestone: 2.0 M1   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2001-12-14 13:18 EST by Adam Kiezun CLA
Modified: 2003-03-17 11:48 EST (History)
0 users

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-14 13:18:19 EST
junit setup
junit.ui.TestRunner::runSuite

the anonymous local type there (subclass of Thread)
the scope has a runtime type BlockScope, which causes CCE in the following line:

if (visitor.visit(this, (MethodScope) blockScope)) {

it is line 124 in AnonymousLocalTypeDeclaration
Comment 1 Adam Kiezun CLA 2001-12-14 13:20:22 EST
for an easy test case - try extracting sth from the run method of that 
anonymous class

stack trace for reference:

4 org.eclipse.ui 0 org.eclipse.jdt.internal.compiler.lookup.BlockScope
java.lang.ClassCastException: 
org.eclipse.jdt.internal.compiler.lookup.BlockScope
	at 
org.eclipse.jdt.internal.compiler.ast.AnonymousLocalTypeDeclaration.traverse
(AnonymousLocalTypeDeclaration.java:124)
	at 
org.eclipse.jdt.internal.compiler.ast.QualifiedAllocationExpression.traverse
(QualifiedAllocationExpression.java:259)
	at org.eclipse.jdt.internal.compiler.ast.Assignment.traverse
(Assignment.java:117)
	at org.eclipse.jdt.internal.compiler.ast.Block.traverse(Block.java:136)
	at org.eclipse.jdt.internal.compiler.ast.IfStatement.traverse
(IfStatement.java:201)
	at org.eclipse.jdt.internal.compiler.ast.Block.traverse(Block.java:136)
	at org.eclipse.jdt.internal.compiler.ast.IfStatement.traverse
(IfStatement.java:203)
	at org.eclipse.jdt.internal.compiler.ast.MethodDeclaration.traverse
(MethodDeclaration.java:93)
	at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.traverse
(TypeDeclaration.java:851)
	at 
org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.traverse
(CompilationUnitDeclaration.java:228)
	at org.eclipse.jdt.internal.core.CompilationUnitVisitor.visit
(CompilationUnitVisitor.java:140)
	at org.eclipse.jdt.internal.core.CompilationUnit.accept
(CompilationUnit.java:59)
	at 
org.eclipse.jdt.internal.corext.refactoring.code.ExtractMethodRefactoring.checkA
ctivation(ExtractMethodRefactoring.java:167)
	at 
org.eclipse.jdt.internal.ui.refactoring.actions.RefactoringAction.activateRefact
oringWizard(RefactoringAction.java:108)
	at 
org.eclipse.jdt.internal.ui.refactoring.actions.TextSelectionBasedRefactoringAct
ion.run(TextSelectionBasedRefactoringAction.java:33)
	at 
org.eclipse.jdt.internal.ui.refactoring.actions.TextSelectionAction.run
(TextSelectionAction.java:93)
	at org.eclipse.ui.internal.PluginAction.run(PluginAction.java:181)
	at org.eclipse.jface.action.Action.runWithEvent(Action.java:452)
	at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection
(ActionContributionItem.java:407)
	at org.eclipse.jface.action.ActionContributionItem.handleWidgetEvent
(ActionContributionItem.java:361)
	at org.eclipse.jface.action.ActionContributionItem.access$0
(ActionContributionItem.java:352)
	at 
org.eclipse.jface.action.ActionContributionItem$ActionListener.handleEvent
(ActionContributionItem.java:47)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:54)
	at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:635)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1368)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1170)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:775)
	at org.eclipse.ui.internal.Workbench.run(Workbench.java:758)
	at org.eclipse.core.internal.boot.InternalBootLoader.run
(InternalBootLoader.java:820)
	at org.eclipse.core.boot.BootLoader.run(BootLoader.java:285)
	at SlimLauncher.main(SlimLauncher.java:14)
Comment 2 Olivier Thomann CLA 2001-12-14 13:23:58 EST
This was a mistake in the code I sent you. The released code doesn't have this 
casting. I simply take a blockscope as a parameter, not a methodscope. I send 
you an updated patch for this one.
Comment 3 Olivier Thomann CLA 2001-12-14 14:55:54 EST
As this refers to code that is not released, I suggest close.
Comment 4 Olivier Thomann CLA 2001-12-14 16:48:05 EST
Please update the PR when you tried to reproduce your problem with the released 
code (using the patch I sent you).
Comment 5 Adam Kiezun CLA 2001-12-17 05:01:15 EST
works - ok to close
thanks
Comment 6 Olivier Thomann CLA 2001-12-17 09:34:49 EST
Move to close, since the code was never officially released and the release code 
doesn't contain the line with the casting.
Comment 7 Olivier Thomann CLA 2001-12-17 09:35:08 EST
Closed.