Skip to content
This repository has been archived by the owner on Jul 2, 2021. It is now read-only.

Quickfix for disallowed keyword 'var' does not work #299

Open
jthoene opened this issue Aug 9, 2019 · 0 comments
Open

Quickfix for disallowed keyword 'var' does not work #299

jthoene opened this issue Aug 9, 2019 · 0 comments
Labels

Comments

@jthoene
Copy link
Collaborator

jthoene commented Aug 9, 2019

The quickfix for the disallowed keyword 'var', which should replace the Variable Definition. Throws the following exception:

org.eclipse.emf.common.util.WrappedException: java.lang.IllegalStateException
	at org.eclipse.xtext.ui.editor.quickfix.IssueResolution.apply(IssueResolution.java:78)
	at org.eclipse.xtext.ui.editor.quickfix.QuickAssistCompletionProposal.apply(QuickAssistCompletionProposal.java:36)
	at org.eclipse.xtext.ui.editor.hover.AnnotationWithQuickFixesHover$AnnotationInformationControl.apply(AnnotationWithQuickFixesHover.java:536)
	at org.eclipse.xtext.ui.editor.hover.AnnotationWithQuickFixesHover$AnnotationInformationControl.access$2(AnnotationWithQuickFixesHover.java:513)
	at org.eclipse.xtext.ui.editor.hover.AnnotationWithQuickFixesHover$AnnotationInformationControl$5.widgetSelected(AnnotationWithQuickFixesHover.java:507)
	at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:252)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:89)
	at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4131)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1056)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1080)
	at org.eclipse.swt.widgets.Widget.sendSelectionEvent(Widget.java:1097)
	at org.eclipse.swt.widgets.Link.wmNotifyChild(Link.java:696)
	at org.eclipse.swt.widgets.Control.wmNotify(Control.java:5785)
	at org.eclipse.swt.widgets.Composite.wmNotify(Composite.java:1988)
	at org.eclipse.swt.widgets.Control.WM_NOTIFY(Control.java:5351)
	at org.eclipse.swt.widgets.Control.windowProc(Control.java:4815)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:4778)
	at org.eclipse.swt.internal.win32.OS.CallWindowProc(Native Method)
	at org.eclipse.swt.widgets.Link.callWindowProc(Link.java:160)
	at org.eclipse.swt.widgets.Widget.wmLButtonUp(Widget.java:1933)
	at org.eclipse.swt.widgets.Control.WM_LBUTTONUP(Control.java:5164)
	at org.eclipse.swt.widgets.Control.windowProc(Control.java:4796)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:4770)
	at org.eclipse.swt.internal.win32.OS.DispatchMessage(Native Method)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3545)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1173)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1062)
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:155)
	at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:635)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:559)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:155)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:203)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:137)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:107)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:400)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:255)
	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.equinox.launcher.Main.invokeFramework(Main.java:660)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:597)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1468)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1441)
Caused by: java.lang.IllegalStateException
	at org.eclipse.xtext.serializer.sequencer.AbstractSyntacticSequencer.enterAssignedParserRuleCall(AbstractSyntacticSequencer.java:353)
	at org.eclipse.xtext.serializer.acceptor.SequenceFeeder.acceptEObjectRuleCall(SequenceFeeder.java:324)
	at org.eclipse.xtext.serializer.acceptor.SequenceFeeder.acceptRuleCall(SequenceFeeder.java:353)
	at org.eclipse.xtext.serializer.acceptor.SequenceFeeder.accept(SequenceFeeder.java:247)
	at org.eclipse.xtext.serializer.sequencer.BacktrackingSemanticSequencer.accept(BacktrackingSemanticSequencer.java:451)
	at org.eclipse.xtext.serializer.sequencer.BacktrackingSemanticSequencer.createSequence(BacktrackingSemanticSequencer.java:511)
	at com.yakindu.solidity.serializer.SoliditySemanticSequencer.sequence_VariableDefinition(SoliditySemanticSequencer.java:2016)
	at com.yakindu.solidity.serializer.SoliditySemanticSequencer.sequence(SoliditySemanticSequencer.java:337)
	at org.eclipse.xtext.serializer.sequencer.AbstractSemanticSequencer.createSequence(AbstractSemanticSequencer.java:67)
	at org.eclipse.xtext.serializer.acceptor.SequenceFeeder.acceptEObjectRuleCall(SequenceFeeder.java:326)
	at org.eclipse.xtext.serializer.acceptor.SequenceFeeder.acceptRuleCall(SequenceFeeder.java:353)
	at org.eclipse.xtext.serializer.acceptor.SequenceFeeder.accept(SequenceFeeder.java:264)
	at org.eclipse.xtext.serializer.sequencer.BacktrackingSemanticSequencer.accept(BacktrackingSemanticSequencer.java:444)
	at org.eclipse.xtext.serializer.sequencer.BacktrackingSemanticSequencer.createSequence(BacktrackingSemanticSequencer.java:511)
	at com.yakindu.solidity.serializer.SoliditySemanticSequencer.sequence_Block(SoliditySemanticSequencer.java:598)
	at com.yakindu.solidity.serializer.SoliditySemanticSequencer.sequence(SoliditySemanticSequencer.java:189)
	at org.eclipse.xtext.serializer.sequencer.AbstractSemanticSequencer.createSequence(AbstractSemanticSequencer.java:67)
	at org.eclipse.xtext.serializer.impl.Serializer.serialize(Serializer.java:118)
	at org.eclipse.xtext.serializer.impl.Serializer.serializeToRegions(Serializer.java:140)
	at org.eclipse.xtext.serializer.impl.Serializer.serialize(Serializer.java:146)
	at org.eclipse.xtext.serializer.impl.Serializer.serialize(Serializer.java:180)
	at org.eclipse.xtext.serializer.impl.Serializer.serializeReplacement(Serializer.java:211)
	at org.eclipse.xtext.ui.editor.model.edit.DefaultTextEditComposer.getObjectEdits(DefaultTextEditComposer.java:176)
	at org.eclipse.xtext.ui.editor.model.edit.DefaultTextEditComposer.getTextEdit(DefaultTextEditComposer.java:146)
	at org.eclipse.xtext.ui.editor.model.edit.DefaultTextEditComposer.endRecording(DefaultTextEditComposer.java:129)
	at org.eclipse.xtext.ui.editor.model.edit.ReconcilingUnitOfWork.exec(ReconcilingUnitOfWork.java:57)
	at org.eclipse.xtext.ui.editor.model.edit.ReconcilingUnitOfWork.exec(ReconcilingUnitOfWork.java:1)
	at org.eclipse.xtext.resource.OutdatedStateManager.exec(OutdatedStateManager.java:91)
	at org.eclipse.xtext.ui.editor.model.XtextDocument$XtextDocumentLocker.modify(XtextDocument.java:434)
	at org.eclipse.xtext.ui.editor.model.XtextDocument.internalModify(XtextDocument.java:167)
	at org.eclipse.xtext.ui.editor.model.XtextDocument.modify(XtextDocument.java:160)
	at org.eclipse.xtext.ui.editor.model.edit.SemanticModificationWrapper.apply(SemanticModificationWrapper.java:32)
	at org.eclipse.xtext.ui.editor.quickfix.IssueResolution.apply(IssueResolution.java:76)
	... 46 more

After some further investigation by me, it seems like the Sequencer does not accept the typeSpecifier set by the quickfix for the replacing VariableDefinition.

Solidity example code to reproduce the problem:

pragma solidity ^0.5.9;
			
contract Test {
    function return0() pure public returns (bool)
    {
        var x = true;
        return x;
    }
}
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

1 participant