Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 356092 - AssertionFailedException at Rename Refactoring
Summary: AssertionFailedException at Rename Refactoring
Status: CLOSED FIXED
Alias: None
Product: TMF
Classification: Modeling
Component: Xtext (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: SR2   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-08-29 11:02 EDT by Christian Dietrich CLA
Modified: 2017-09-19 17:42 EDT (History)
2 users (show)

See Also:
jan: indigo+


Attachments
Grammatik (501 bytes, text/plain)
2011-08-29 11:02 EDT, Christian Dietrich CLA
no flags Details
Scope Provider (894 bytes, text/plain)
2011-08-29 11:03 EDT, Christian Dietrich CLA
no flags Details
Test Modelle (2.28 KB, application/x-zip-compressed)
2011-08-29 11:04 EDT, Christian Dietrich CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Christian Dietrich CLA 2011-08-29 11:02:03 EDT
Build Identifier: 2.0.0 + 2.0.1

Rename Refactoring does not work if a "third" resource is needed for the scoping during the refactoring.

A is a resource that declares the Element X
B is a Resource that references the Element
C is a Resource that is used to make X visible in B

since only A and B are part of the resourceset, but C not,
scoping will not find anything in org.eclipse.xtext.parsetree.reconstr.impl.CrossReferenceSerializer.getUnconvertedLinkText(EObject, EReference, EObject).

This leads to following trace

org.eclipse.core.runtime.AssertionFailedException: null argument:
	at org.eclipse.core.runtime.Assert.isNotNull(Assert.java:85)
	at org.eclipse.core.runtime.Assert.isNotNull(Assert.java:73)
	at org.eclipse.text.edits.ReplaceEdit.<init>(ReplaceEdit.java:37)
	at org.eclipse.xtext.ui.refactoring.impl.DefaultReferenceUpdater.createReferenceUpdate(DefaultReferenceUpdater.java:98)
	at org.eclipse.xtext.ui.refactoring.impl.DefaultReferenceUpdater.createReferenceUpdate(DefaultReferenceUpdater.java:84)
	at org.eclipse.xtext.ui.refactoring.impl.DefaultReferenceUpdater.createReferenceUpdates(DefaultReferenceUpdater.java:69)
	at org.eclipse.xtext.ui.refactoring.impl.AbstractReferenceUpdater.createReferenceUpdates(AbstractReferenceUpdater.java:60)
	at org.eclipse.xtext.ui.refactoring.impl.ReferenceUpdaterDispatcher.createReferenceUpdates(ReferenceUpdaterDispatcher.java:61)
	at org.eclipse.xtext.ui.refactoring.impl.RenameElementProcessor.checkFinalConditions(RenameElementProcessor.java:203)
	at org.eclipse.ltk.core.refactoring.participants.ProcessorBasedRefactoring.checkFinalConditions(ProcessorBasedRefactoring.java:224)
	at org.eclipse.ltk.core.refactoring.Refactoring.checkAllConditions(Refactoring.java:160)
	at org.eclipse.xtext.ui.refactoring.ui.RenameRefactoringExecuter$CheckConditionsAndCreateChangeRunnable.run(RenameRefactoringExecuter.java:131)
	at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2344)
	at org.eclipse.xtext.ui.refactoring.ui.WorkbenchRunnableAdapter.run(WorkbenchRunnableAdapter.java:81)
	at org.eclipse.jface.operation.ModalContext.runInCurrentThread(ModalContext.java:464)
	at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:372)
	at org.eclipse.jface.window.ApplicationWindow$1.run(ApplicationWindow.java:759)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
	at org.eclipse.jface.window.ApplicationWindow.run(ApplicationWindow.java:756)
	at org.eclipse.ui.internal.WorkbenchWindow.run(WorkbenchWindow.java:2642)
	at org.eclipse.xtext.ui.refactoring.ui.RenameRefactoringExecuter.execute(RenameRefactoringExecuter.java:89)
	at org.eclipse.xtext.ui.refactoring.ui.DefaultRenameSupport.startDirectRefactoring(DefaultRenameSupport.java:117)
	at org.eclipse.xtext.ui.refactoring.ui.RenameRefactoringController.startDirectRefactoring(RenameRefactoringController.java:138)
	at org.eclipse.xtext.ui.refactoring.ui.RenameRefactoringController.startRefactoring(RenameRefactoringController.java:77)
	at org.eclipse.xtext.ui.refactoring.ui.RenameLinkedMode$EditorSynchronizer.left(RenameLinkedMode.java:174)
	at org.eclipse.jface.text.link.LinkedModeModel.exit(LinkedModeModel.java:341)
	at org.eclipse.jface.text.link.LinkedModeUI$4.run(LinkedModeUI.java:1194)
	at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:135)
	at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4140)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3757)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2696)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2660)
	at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2494)
	at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:674)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:667)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:123)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:344)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1410)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1386)

Attachments for grammar and scoping + testmodel will follow

Reproducible: Always
Comment 1 Christian Dietrich CLA 2011-08-29 11:02:51 EDT
Created attachment 202331 [details]
Grammatik
Comment 2 Christian Dietrich CLA 2011-08-29 11:03:15 EDT
Created attachment 202332 [details]
Scope Provider
Comment 3 Christian Dietrich CLA 2011-08-29 11:04:13 EDT
Created attachment 202333 [details]
Test Modelle
Comment 4 Christian Dietrich CLA 2011-08-29 11:04:27 EDT
As problem tritt beim renaming von a1 auf
Comment 5 Jan Koehnlein CLA 2011-09-02 07:39:49 EDT
When updating references in the refactoring, we used ResourceSetBasedDescriptions as we are working in our own resource set simulting the changes. That way the indexed descriptions were not available at all and consequently the link to the kontext could not be resolved, resulting int the reported exception.

I've introduced a LiveShadowingResourceDescriptions wihich shadows the indexed resource descriptions with the contents of the resource set. Also added a test.
Comment 6 Karsten Thoms CLA 2017-09-19 17:31:07 EDT
Closing all bugs that were set to RESOLVED before Neon.0
Comment 7 Karsten Thoms CLA 2017-09-19 17:42:17 EDT
Closing all bugs that were set to RESOLVED before Neon.0