itemisCREATE / statecharts

YAKINDU Statechart Tools (http://www.statecharts.org)
Eclipse Public License 1.0
175 stars 85 forks source link

[Refactoring] Rename refactoring does not work for float expressions #1932

Closed ghost closed 6 years ago

ghost commented 6 years ago

It is not possible to rename-refactor variables that have the type "float" with an initial value assigned. Assume the following is specified in the statechart definition section :

interface TestScope:
var testing: float = 1.0f

Now, when you try to rename-refactor this variable ( "Right click->Rename Refactoring...") to i.e. "renamedVariable" actually nothing happens. The following exception occurs:


org.eclipse.xtext.parsetree.reconstr.XtextSerializationException: Serialization failed
<# of serialized tokens>: <EObject path> "<serializable fragment, starting from the end>":
  -> <possible reasons for not continuing>
47:Statechart'default'.scopes[0]->InterfaceScope'TestScope'.members[0]->VariableDefinition'renamedVariable'.initialValue->PrimitiveValueExpression.value->FloatLiteral: "":
  -> FloatLiteral_ValueAssignment_1: The value '1.0' is an invalid FLOAT
45:Statechart'default'.scopes[0]->InterfaceScope'TestScope'.members[0]->VariableDefinition'renamedVariable'.initialValue->PrimitiveValueExpression.value->FloatLiteral: "":
  -> FloatLiteral_ValueAssignment_1: The value '1.0' is an invalid FLOAT
15:Statechart'default'.scopes[0]->InterfaceScope'TestScope'.members[0]->VariableDefinition'renamedVariable': "var renamedVariable : float":
  -> VariableDefinition_VariableDefinitionAction_0: n/a
13:Statechart'default'.scopes[0]->InterfaceScope'TestScope'.members[0]->VariableDefinition'renamedVariable'.typeSpecifier->TypeSpecifier: ">":
  -> TypeSpecifier_TypeArgumentsAssignment_1_1_1_1: All 0 values of TypeSpecifier.typeArguments have been consumed. More are needed to continue here.
11:Statechart'default'.scopes[0]->InterfaceScope'TestScope'.members[0]->VariableDefinition'renamedVariable'.typeSpecifier->TypeSpecifier: ">":
  -> TypeSpecifier_TypeArgumentsAssignment_1_1_1_1: All 0 values of TypeSpecifier.typeArguments have been consumed. More are needed to continue here.
6:Statechart'default'.scopes[0]->InterfaceScope'TestScope': "interface TestScope :":
  -> InterfaceScope_InterfaceScopeAction_0: n/a
5:Statechart'default'.scopes[0]->InterfaceScope'TestScope': "interface :":
  -> InterfaceScope_InterfaceScopeAction_0: n/a
4:Statechart'default'.scopes[0]->InterfaceScope'TestScope': "interface TestScope :":
  -> InterfaceScope_InterfaceScopeAction_0: n/a
3:Statechart'default'.scopes[0]->InterfaceScope'TestScope': "interface :":
  -> InterfaceScope_InterfaceScopeAction_0: n/a
    at org.eclipse.xtext.parsetree.reconstr.impl.AbstractParseTreeConstructor.serialize(AbstractParseTreeConstructor.java:684)
    at org.eclipse.xtext.parsetree.reconstr.impl.AbstractParseTreeConstructor.serialize(AbstractParseTreeConstructor.java:691)
    at org.eclipse.xtext.parsetree.reconstr.impl.AbstractParseTreeConstructor.serializeSubtree(AbstractParseTreeConstructor.java:715)
    at org.eclipse.xtext.parsetree.reconstr.Serializer.serialize(Serializer.java:64)
    at org.eclipse.xtext.parsetree.reconstr.Serializer.serialize(Serializer.java:83)
    at org.eclipse.xtext.parsetree.reconstr.Serializer.serialize(Serializer.java:76)
    at org.yakindu.sct.model.sgraph.resource.AbstractSCTResource.serialize(AbstractSCTResource.java:393)
    at org.yakindu.sct.model.stext.resource.StextResource.serializeStatechart(StextResource.java:60)
    at org.yakindu.sct.model.sgraph.resource.AbstractSCTResource.serializeSpecificationElement(AbstractSCTResource.java:378)
    at org.yakindu.sct.model.sgraph.resource.AbstractSCTResource$SerializeAdapter.notifyChanged(AbstractSCTResource.java:427)
    at org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify(BasicNotifierImpl.java:374)
    at org.yakindu.base.types.impl.DeclarationImpl.setName(DeclarationImpl.java:197)
    at org.yakindu.sct.refactoring.refactor.impl.RenameRefactoring.internalExecute(RenameRefactoring.java:64)
    at org.yakindu.sct.refactoring.refactor.AbstractRefactoring.executeRefactoring(AbstractRefactoring.java:128)
    at org.yakindu.sct.refactoring.refactor.AbstractRefactoring$1.doExecuteWithResult(AbstractRefactoring.java:98)
    at org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand.doExecute(AbstractTransactionalCommand.java:247)
    at org.eclipse.emf.workspace.AbstractEMFOperation.execute(AbstractEMFOperation.java:150)
    at org.eclipse.core.commands.operations.DefaultOperationHistory.execute(DefaultOperationHistory.java:488)
    at org.yakindu.sct.refactoring.refactor.AbstractRefactoring.executeCommand(AbstractRefactoring.java:194)
    at org.yakindu.sct.refactoring.refactor.AbstractRefactoring.executeCommand(AbstractRefactoring.java:184)
    at org.yakindu.sct.refactoring.refactor.AbstractRefactoring.executeCommand(AbstractRefactoring.java:117)
    at org.yakindu.sct.refactoring.refactor.AbstractRefactoring.execute(AbstractRefactoring.java:113)
    at org.yakindu.sct.refactoring.handlers.impl.RenameElementHandler.execute(RenameElementHandler.java:62)
    at org.eclipse.ui.internal.handlers.HandlerProxy.execute(HandlerProxy.java:295)
    at org.eclipse.ui.internal.handlers.E4HandlerProxy.execute(E4HandlerProxy.java:90)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:55)
    at org.eclipse.e4.core.internal.di.InjectorImpl.invokeUsingClass(InjectorImpl.java:282)
    at org.eclipse.e4.core.internal.di.InjectorImpl.invoke(InjectorImpl.java:264)
    at org.eclipse.e4.core.contexts.ContextInjectionFactory.invoke(ContextInjectionFactory.java:132)
    at org.eclipse.e4.core.commands.internal.HandlerServiceHandler.execute(HandlerServiceHandler.java:152)
    at org.eclipse.core.commands.Command.executeWithChecks(Command.java:494)
    at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:488)
    at org.eclipse.e4.core.commands.internal.HandlerServiceImpl.executeHandler(HandlerServiceImpl.java:210)
    at org.eclipse.e4.ui.workbench.renderers.swt.HandledContributionItem.executeItem(HandledContributionItem.java:433)
    at org.eclipse.e4.ui.workbench.renderers.swt.AbstractContributionItem.handleWidgetSelection(AbstractContributionItem.java:454)
    at org.eclipse.e4.ui.workbench.renderers.swt.AbstractContributionItem$3.handleEvent(AbstractContributionItem.java:482)
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
    at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4418)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1079)
    at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4236)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3824)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$4.run(PartRenderingEngine.java:1121)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1022)
    at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:150)
    at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:693)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
    at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:610)
    at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:148)
    at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:138)
    at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:388)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:243)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:673)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:610)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1519)
    at org.eclipse.equinox.launcher.Main.main(Main.java:1492)```
ghost commented 6 years ago

Fixed with baeda2b