Project: JDT
Bug 81612 Invalid thread access while refactoring
Reported: 2004-12-19 12:08:04 | Status: verified fixed

3.1M4 running Java5, compliance set to 1.4/default Having package foo.bar; public interface IConstant { String FOO = "Foo"; } package foo.bar; public class AClass { } package foo.bar; public class BClass { public static final String FOO = "Foo"; } Moving "FOO" from the Interface to A fails with an invalid thread accesa, while moving "FOO" from B to A works. When the definition in the interface is changed to "public static final String FOO = "Foo";" moving from the interface works too. !ENTRY org.eclipse.ltk.ui.refactoring 4 10000 2004-12-19 18:09:30.421 !MESSAGE Internal Error !STACK 0 java.lang.reflect.InvocationTargetException at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:303) at org.eclipse.ltk.internal.ui.refactoring.RefactoringWizardDialog2.run(RefactoringWizardDialog2.java:282) at org.eclipse.ltk.ui.refactoring.RefactoringWizard.internalPerformFinish(RefactoringWizard.java:539) at org.eclipse.ltk.ui.refactoring.UserInputWizardPage.performFinish(UserInputWizardPage.java:153) at org.eclipse.jdt.internal.ui.refactoring.MoveMembersWizard$MoveMembersInputPage.performFinish(MoveMembersWizard.java:191) at org.eclipse.ltk.ui.refactoring.RefactoringWizard.performFinish(RefactoringWizard.java:605) at org.eclipse.ltk.internal.ui.refactoring.RefactoringWizardDialog2.okPressed(RefactoringWizardDialog2.java:406) at org.eclipse.jface.dialogs.Dialog.buttonPressed(Dialog.java:396) at org.eclipse.jface.dialogs.Dialog$2.widgetSelected(Dialog.java:543) at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:89) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:833) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:2803) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2448) at org.eclipse.jface.window.Window.runEventLoop(Window.java:718) at org.eclipse.jface.window.Window.open(Window.java:696) at org.eclipse.ltk.ui.refactoring.RefactoringWizardOpenOperation$1.run(RefactoringWizardOpenOperation.java:125) at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:69) at org.eclipse.ltk.ui.refactoring.RefactoringWizardOpenOperation.run(RefactoringWizardOpenOperation.java:138) at org.eclipse.jdt.internal.ui.refactoring.actions.RefactoringStarter.activate(RefactoringStarter.java:40) at org.eclipse.jdt.internal.ui.refactoring.actions.MoveStaticMembersAction.startRefactoring(MoveStaticMembersAction.java:164) at org.eclipse.jdt.internal.ui.refactoring.actions.MoveStaticMembersAction.run(MoveStaticMembersAction.java:117) at org.eclipse.jdt.ui.actions.MoveAction.tryMoveStaticMembers(MoveAction.java:173) at org.eclipse.jdt.ui.actions.MoveAction.run(MoveAction.java:145) at org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchRun(SelectionDispatchAction.java:216) at org.eclipse.jdt.ui.actions.SelectionDispatchAction.run(SelectionDispatchAction.java:188) at org.eclipse.jface.action.Action.runWithEvent(Action.java:989) at org.eclipse.ui.commands.ActionHandler.execute(ActionHandler.java:188) at org.eclipse.ui.internal.commands.Command.execute(Command.java:130) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.executeCommand(WorkbenchKeyboard.java:445) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.press(WorkbenchKeyboard.java:724) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.processKeyEvent(WorkbenchKeyboard.java:767) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.filterKeySequenceBindings(WorkbenchKeyboard.java:536) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.access$2(WorkbenchKeyboard.java:479) at org.eclipse.ui.internal.keys.WorkbenchKeyboard$1.handleEvent(WorkbenchKeyboard.java:221) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82) at org.eclipse.swt.widgets.Display.filterEvent(Display.java:752) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:832) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:857) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:842) at org.eclipse.swt.widgets.Control.traverse(Control.java:2759) at org.eclipse.swt.widgets.Control.translateMnemonic(Control.java:2600) at org.eclipse.swt.widgets.Composite.translateMnemonic(Composite.java:786) at org.eclipse.swt.widgets.Control.translateMnemonic(Control.java:2618) at org.eclipse.swt.widgets.Display.translateMnemonic(Display.java:3223) at org.eclipse.swt.widgets.Display.filterMessage(Display.java:766) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2444) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1569) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1540) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:285) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:144) at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:102) at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:220) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:273) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:129) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.eclipse.core.launcher.Main.basicRun(Main.java:185) at org.eclipse.core.launcher.Main.run(Main.java:710) at org.eclipse.core.launcher.Main.main(Main.java:694) Caused by: org.eclipse.swt.SWTException: Invalid thread access at org.eclipse.swt.SWT.error(SWT.java:2827) at org.eclipse.swt.SWT.error(SWT.java:2752) at org.eclipse.swt.SWT.error(SWT.java:2723) at org.eclipse.swt.widgets.Widget.error(Widget.java:388) at org.eclipse.swt.widgets.Widget.checkWidget(Widget.java:291) at org.eclipse.swt.custom.StyledText.getLineAtOffset(StyledText.java:3691) at org.eclipse.swt.custom.StyledText$ContentWidthCache.textChanged(StyledText.java:1395) at org.eclipse.swt.custom.StyledText.handleTextChanged(StyledText.java:5151) at org.eclipse.swt.custom.StyledText$6.textChanged(StyledText.java:4713) at org.eclipse.jface.text.DefaultDocumentAdapter.fireTextChanged(DefaultDocumentAdapter.java:337) at org.eclipse.jface.text.DefaultDocumentAdapter.documentChanged(DefaultDocumentAdapter.java:281) at org.eclipse.jface.text.AbstractDocument.doFireDocumentChanged2(AbstractDocument.java:704) at org.eclipse.jface.text.AbstractDocument.doFireDocumentChanged(AbstractDocument.java:677) at org.eclipse.jface.text.AbstractDocument.doFireDocumentChanged(AbstractDocument.java:662) at org.eclipse.jface.text.AbstractDocument.fireDocumentChanged(AbstractDocument.java:739) at org.eclipse.jface.text.AbstractDocument.replace(AbstractDocument.java:1030) at org.eclipse.jdt.internal.ui.javaeditor.PartiallySynchronizedDocument.replace(PartiallySynchronizedDocument.java:92) at org.eclipse.text.edits.InsertEdit.performDocumentUpdating(InsertEdit.java:78) at org.eclipse.text.edits.TextEdit.traverseDocumentUpdating(TextEdit.java:850) at org.eclipse.text.edits.TextEdit.traverseDocumentUpdating(TextEdit.java:843) at org.eclipse.text.edits.TextEdit.traverseDocumentUpdating(TextEdit.java:843) at org.eclipse.text.edits.TextEditProcessor.executeDo(TextEditProcessor.java:185) at org.eclipse.text.edits.TextEdit.dispatchPerformEdits(TextEdit.java:704) at org.eclipse.text.edits.TextEditProcessor.performEdits(TextEditProcessor.java:153) at org.eclipse.text.edits.TextEdit.apply(TextEdit.java:676) at org.eclipse.jdt.internal.corext.refactoring.structure.MoveStaticMembersProcessor.getUpdatedMemberSource(MoveStaticMembersProcessor.java:923) at org.eclipse.jdt.internal.corext.refactoring.structure.MoveStaticMembersProcessor.createChange(MoveStaticMembersProcessor.java:796) at org.eclipse.jdt.internal.corext.refactoring.structure.MoveStaticMembersProcessor.checkFinalConditions(MoveStaticMembersProcessor.java:383) at org.eclipse.ltk.core.refactoring.participants.ProcessorBasedRefactoring.checkFinalConditions(ProcessorBasedRefactoring.java:153) at org.eclipse.ltk.core.refactoring.CheckConditionsOperation.run(CheckConditionsOperation.java:84) at org.eclipse.ltk.core.refactoring.CreateChangeOperation.run(CreateChangeOperation.java:114) at org.eclipse.ltk.core.refactoring.PerformChangeOperation.run(PerformChangeOperation.java:188) at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1674) at org.eclipse.ltk.internal.ui.refactoring.WorkbenchRunnableAdapter.run(WorkbenchRunnableAdapter.java:58) at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:105)

Files changed in fix:
org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/structure/MoveStaticMembersProcessor.java