| Summary: | ClassCastException in CommandContext when an expression returns an empty set | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Modeling] Sirius | Reporter: | Stephane Begaudeau <stephane.begaudeau> | ||||
| Component: | Core | Assignee: | Pierre-Charles David <pierre-charles.david> | ||||
| Status: | CLOSED FIXED | QA Contact: | Julien Dupont <julien.dupont> | ||||
| Severity: | major | ||||||
| Priority: | P3 | CC: | alex.lagarde, florian.barbin, julien.dupont, pierre-charles.david | ||||
| Version: | 1.0.0 | Keywords: | triaged | ||||
| Target Milestone: | 1.0.0M7 | ||||||
| Hardware: | All | ||||||
| OS: | All | ||||||
| Whiteboard: | |||||||
| Attachments: |
|
||||||
|
Description
Stephane Begaudeau
Hi Stephane, could you please join steps to reproduce the issue? (In reply to Alex Lagarde from comment #1) > Hi Stephane, could you please join steps to reproduce the issue? Ask Julien :) It was an Acceleo expression involving eInverse() which must have returned an empty set. Created attachment 238906 [details]
Use case to reproduce Class Cast Exception
To reproduce:
Open the use case representation Diagram and select node named Class1. Try to remove. Does Nothing, open the view "Error Log". The Class Cast Exeption appears.
This problem is in the VSM on remove tool, with this expression: "[oclAsType(ecore::EReference).eInverse()/]" that return an empty list.
I renamed the ticket for more clarity, so here is the actual exception (which was used as a title previously): Caused by: java.lang.ClassCastException: java.util.Collections$EmptySet cannot be cast to java.util.List See https://git.eclipse.org/r/#/c/25343/. Note that the suggestion for further simplification in #c1 would not work: result is statically known as a raw Object, so even if it is actually a collection, Lists.newArrayList(result) would call the Lists.newArrayList(E... elements) variant, which would result in a list with a single element (which would happen to be a collection). Fixed by 3d05b28b007ea955c7ad566a6a13d1577c00e364. Available in Sirius 1.0.0M7 (see https://wiki.eclipse.org/Sirius/1.0.0M7 & http://git.eclipse.org/c/sirius/org.eclipse.sirius.git/tag/?id=v1.0.0M7). |