| Summary: | CCE on AQL completion | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Modeling] Sirius | Reporter: | Esteban DUGUEPEROUX <esteban.dugueperoux> | ||||
| Component: | Diagram | Assignee: | Project Inbox <sirius.diagram-inbox> | ||||
| Status: | CLOSED FIXED | QA Contact: | Jessy Mallet <jessy.mallet> | ||||
| Severity: | normal | ||||||
| Priority: | P3 | CC: | cedric.brun, florian.barbin, jessy.mallet, laurent.goubet, pierre-charles.david | ||||
| Version: | 3.0.0 | Keywords: | triaged | ||||
| Target Milestone: | 3.1.0 | ||||||
| Hardware: | PC | ||||||
| OS: | Linux | ||||||
| See Also: |
https://git.eclipse.org/r/55717 https://git.eclipse.org/c/sirius/org.eclipse.sirius.git/commit/?id=69251eb1f7e70c532bdb25e0181d7ff28a994ca4 https://git.eclipse.org/r/55982 https://git.eclipse.org/c/sirius/org.eclipse.sirius.git/commit/?id=2636f0a664aeeab9fed648c52fae8100a8bc95a7 |
||||||
| Whiteboard: | |||||||
| Bug Depends on: | |||||||
| Bug Blocks: | 470460 | ||||||
| Attachments: |
|
||||||
Scenario to reproduce : 1. Import the attached projet 2. Open the odesign and select the first Variable Filter 3. In the semantic candidates expession test AQL completion between last brackets, i.e. in ->collect() => KO Another AQL completion issue with the attached sample project but now with the interpreter view from Acceleo : 1. Set focus on the diagram in the sample, 2. Use Sirius interpreter mode instead of Acceleo default one, 3. Start from "aql:self.target." expression, and Ctrl+Space type "eAll" to have "eAllContents" proposed, type Esc to remove completion and Ctrl+Space again to have completion and select "eAllContents" again =>KO "aql:self.target.eAlleAllContents()" is set as expression instead of "aql:self.target.eAllContents()" With the same project sample, with diagram in context, an expression to retreive "newEClass1" : - with A3 it works : [self.target.eAllContents()->select(oclIsKindOf(ecore::ENamedElement))->select(oclAsType(ecore::ENamedElement).name='newEClass1')/] - but with AQL, if I write "aql:self.target.eAllContents()->select(name='newEClass1')" it is displayed "1 error detected" and AcceleoQueryEvaluationException in tooltip But it seems that a more correct AQL expression would be : aql:self.target.eAllContents()->select(c : EClass | c.name='newEClass1') which is correctly evaluated in interpreter view but in odesign the validation show error with it. Under first diagram description, creates a filter with a variable filter then in the "semantic candidates expression" set "aql:self.target.eAllContents()->select(c : EClass | c.name='newEClass1')" and launch validation. 3 errors markers are created : - Twice "Attempt to access feature (target) on a non ModelObject value (interface org.eclipse.emf.ecore.EObject)." - And "The c variable has no types" If I try with "aql:self.oclAsType(viewpoint::DSemanticDecorator).target.eAllContents(ecore::EClass)->select(c : ecore::EClass | c.name='newEClass2')" I have "ErrorTypeLiteral" error marker in addition. (In reply to Esteban DUGUEPEROUX from comment #1) > Scenario to reproduce : > > 1. Import the attached projet > 2. Open the odesign and select the first Variable Filter > 3. In the semantic candidates expession test AQL completion between last > brackets, i.e. in ->collect() => KO This is still true with org.acceleo.query-3.6.1.20150902 (In reply to Esteban DUGUEPEROUX from comment #1) > Scenario to reproduce : > > 1. Import the attached projet > 2. Open the odesign and select the first Variable Filter > 3. In the semantic candidates expession test AQL completion between last > brackets, i.e. in ->collect() => KO This is still true with org.acceleo.query-3.6.1.20150902(In reply to Esteban DUGUEPEROUX from comment #2) > Another AQL completion issue with the attached sample project but now with > the interpreter view from Acceleo : > > 1. Set focus on the diagram in the sample, > 2. Use Sirius interpreter mode instead of Acceleo default one, > 3. Start from "aql:self.target." expression, and Ctrl+Space type "eAll" to > have "eAllContents" proposed, type Esc to remove completion and Ctrl+Space > again to have completion and select "eAllContents" again =>KO > "aql:self.target.eAlleAllContents()" is set as expression instead of > "aql:self.target.eAllContents()" This one is fixed with Sirius 3.1 and org.acceleo.query-3.6.1.20150902
Sorry, comments mangling this issue :
> > Another AQL completion issue with the attached sample project but now with
> > the interpreter view from Acceleo :
> >
> > 1. Set focus on the diagram in the sample,
> > 2. Use Sirius interpreter mode instead of Acceleo default one,
> > 3. Start from "aql:self.target." expression, and Ctrl+Space type "eAll" to
> > have "eAllContents" proposed, type Esc to remove completion and Ctrl+Space
> > again to have completion and select "eAllContents" again =>KO
> > "aql:self.target.eAlleAllContents()" is set as expression instead of
> > "aql:self.target.eAllContents()"
>
is fixed with Sirius 3.1 and org.acceleo.query-3.6.1.20150902
> which is correctly evaluated in interpreter view but in odesign the > validation show error with it. Under first diagram description, creates a > filter with a variable filter then in the "semantic candidates expression" > set "aql:self.target.eAllContents()->select(c : EClass | > c.name='newEClass1')" and launch validation. 3 errors markers are created : > > - Twice "Attempt to access feature (target) on a non ModelObject value > (interface org.eclipse.emf.ecore.EObject)." > - And "The c variable has no types" With org.acceleo.query-3.6.1.20150902 I only get one error: which is "attempt to access feature "target" on a non model object value which is expected as the "self" variable only has the EObject type. > > > If I try with > "aql:self.oclAsType(viewpoint::DSemanticDecorator).target.eAllContents(ecore: > :EClass)->select(c : ecore::EClass | c.name='newEClass2')" I have > "ErrorTypeLiteral" error marker in addition. Also fixed with org.acceleo.query-3.6.1.20150902, no error is triggered anymore. All in all, only one issue remain which is the classcast and lack of completion mentionned in https://bugs.eclipse.org/bugs/show_bug.cgi?id=475580#c1 java.lang.ClassCastException: org.eclipse.acceleo.query.validation.type.NothingType cannot be cast to org.eclipse.acceleo.query.validation.type.EClassifierType at org.eclipse.acceleo.query.runtime.impl.completion.VariableDeclarationCompletionProposal.getProposal(VariableDeclarationCompletionProposal.java:58) at org.eclipse.acceleo.query.runtime.impl.BasicFilter.keepProposal(BasicFilter.java:48) at org.eclipse.acceleo.query.runtime.impl.CompletionResult.getProposals(CompletionResult.java:66) at org.eclipse.sirius.common.acceleo.aql.ide.proposal.AQLProposalProvider.getProposals(AQLProposalProvider.java:106) at org.eclipse.sirius.common.acceleo.aql.ide.proposal.AQLProposalProvider.getProposals(AQLProposalProvider.java:76) at org.eclipse.sirius.common.tools.api.interpreter.CompoundInterpreter.getProposals(CompoundInterpreter.java:836) at org.eclipse.sirius.ui.tools.api.assist.TextContentProposalProvider.getProposals(TextContentProposalProvider.java:88) at org.eclipse.jface.fieldassist.ContentProposalAdapter.getProposals(ContentProposalAdapter.java:2038) at org.eclipse.jface.fieldassist.ContentProposalAdapter.openProposalPopup(ContentProposalAdapter.java:1882) at org.eclipse.jface.fieldassist.ContentProposalAdapter.access$16(ContentProposalAdapter.java:1877) at org.eclipse.jface.fieldassist.ContentProposalAdapter$1.handleEvent(ContentProposalAdapter.java:1748) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84) at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4481) This bug stems from Sirius itself, specifically from: org.eclipse.sirius.common.acceleo.aql.business.api.org.eclipse.sirius.common.acceleo.aql.business.api(IInterpreterContext, IQueryEnvironment) When calling for the completion at the location outlined by Esteban in comment #1, we go through the above method with nothing in our interpreter context, not even a typing for "self". In such a case, it will do (at line 62) : if (selfTyping.size() == 0) { selfTyping.add(new ClassType(queryEnvironment, EObject.class)); } But "ClassType" is for Java Classes, not for model Classes. This should have been if (selfTyping.size() == 0) { selfTyping.add(new EClassifierType(queryEnvironment, EcorePackage.eINSTANCE.getEObject())); } New Gerrit change created: https://git.eclipse.org/r/55717 Gerrit change https://git.eclipse.org/r/55717 was merged to [master]. Commit: http://git.eclipse.org/c/sirius/org.eclipse.sirius.git/commit/?id=69251eb1f7e70c532bdb25e0181d7ff28a994ca4 I now get a different CCE from JFace, with Esteban's scenario on current master (with http://git.eclipse.org/c/sirius/org.eclipse.sirius.git/commit/?id=69251eb1f7e70c532bdb25e0181d7ff28a994ca4 merged): java.lang.ClassCastException: org.eclipse.jface.viewers.StructuredSelection cannot be cast to org.eclipse.jface.viewers.TreeSelection at org.eclipse.sirius.ui.tools.api.assist.TextContentProposalProvider.getSelectedElement(TextContentProposalProvider.java:109) at org.eclipse.sirius.ui.tools.api.assist.TextContentProposalProvider.getContentContext(TextContentProposalProvider.java:100) at org.eclipse.sirius.ui.tools.api.assist.TextContentProposalProvider.getProposals(TextContentProposalProvider.java:80) at org.eclipse.jface.fieldassist.ContentProposalAdapter.getProposals(ContentProposalAdapter.java:2057) at org.eclipse.jface.fieldassist.ContentProposalAdapter.openProposalPopup(ContentProposalAdapter.java:1903) at org.eclipse.jface.fieldassist.ContentProposalAdapter.access$16(ContentProposalAdapter.java:1898) at org.eclipse.jface.fieldassist.ContentProposalAdapter$1.handleEvent(ContentProposalAdapter.java:1769) New Gerrit change created: https://git.eclipse.org/r/55982 With https://git.eclipse.org/r/55982 [475580] Avoid CCE in interpreted expression completion the original scenario seems to work. The completion popup is a little slow to appear (the first time), but at least it appears, with no error in the error log. It offers a single proposal: "eObjects : ecore::EObject | ", which seems fine given the context. Gerrit change https://git.eclipse.org/r/55982 was merged to [master]. Commit: http://git.eclipse.org/c/sirius/org.eclipse.sirius.git/commit/?id=2636f0a664aeeab9fed648c52fae8100a8bc95a7 Secondary failure fixed by 2636f0a664aeeab9fed648c52fae8100a8bc95a7. Validated with Sirius 3.1.0.201509241504 Available in Sirius 3.1.0. |
Created attachment 256008 [details] Project sample to reproduce I get the following CCE on AQL completion : java.lang.ClassCastException: org.eclipse.acceleo.query.validation.type.NothingType cannot be cast to org.eclipse.acceleo.query.validation.type.EClassifierType at org.eclipse.acceleo.query.runtime.impl.completion.VariableDeclarationCompletionProposal.getProposal(VariableDeclarationCompletionProposal.java:58) at org.eclipse.acceleo.query.runtime.impl.BasicFilter.keepProposal(BasicFilter.java:48) at org.eclipse.acceleo.query.runtime.impl.CompletionResult.getProposals(CompletionResult.java:66) at org.eclipse.sirius.common.acceleo.aql.ide.proposal.AQLProposalProvider.getProposals(AQLProposalProvider.java:105) at org.eclipse.sirius.common.acceleo.aql.ide.proposal.AQLProposalProvider.getProposals(AQLProposalProvider.java:75) at org.eclipse.sirius.common.tools.api.interpreter.CompoundInterpreter.getProposals(CompoundInterpreter.java:803) at org.eclipse.sirius.ui.tools.api.assist.TextContentProposalProvider.getProposals(TextContentProposalProvider.java:88) at org.eclipse.jface.fieldassist.ContentProposalAdapter.getProposals(ContentProposalAdapter.java:2038) at org.eclipse.jface.fieldassist.ContentProposalAdapter.openProposalPopup(ContentProposalAdapter.java:1882) at org.eclipse.jface.fieldassist.ContentProposalAdapter.access$16(ContentProposalAdapter.java:1877) at org.eclipse.jface.fieldassist.ContentProposalAdapter$1.handleEvent(ContentProposalAdapter.java:1748) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84) at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4481) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1327) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1351) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1336) at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1363) at org.eclipse.swt.widgets.Widget.gtk_key_press_event(Widget.java:763) at org.eclipse.swt.widgets.Control.gtk_key_press_event(Control.java:3317) at org.eclipse.swt.widgets.Text.gtk_key_press_event(Text.java:1810) at org.eclipse.swt.widgets.Widget.windowProc(Widget.java:1965) at org.eclipse.swt.widgets.Control.windowProc(Control.java:5590) at org.eclipse.swt.widgets.Text.windowProc(Text.java:2767) at org.eclipse.swt.widgets.Display.windowProc(Display.java:4717) at org.eclipse.swt.internal.gtk.OS._gtk_main_do_event(Native Method) at org.eclipse.swt.internal.gtk.OS.gtk_main_do_event(OS.java:9272) at org.eclipse.swt.widgets.Display.eventProc(Display.java:1225) at org.eclipse.swt.internal.gtk.OS._g_main_context_iteration(Native Method) at org.eclipse.swt.internal.gtk.OS.g_main_context_iteration(OS.java:2422) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3428) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$4.run(PartRenderingEngine.java:1127) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:337) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1018) at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:156) at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:654) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:337) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:598) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150) at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:139) 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:380) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:235) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:669) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:608) at org.eclipse.equinox.launcher.Main.run(Main.java:1515) at org.eclipse.equinox.launcher.Main.main(Main.java:1488)