Community
Participate
Working Groups
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
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)
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.
As this refers to code that is not released, I suggest close.
Please update the PR when you tried to reproduce your problem with the released code (using the patch I sent you).
works - ok to close thanks
Move to close, since the code was never officially released and the release code doesn't contain the line with the casting.
Closed.