Community
Participate
Working Groups
Created attachment 196644 [details] patch to solve the problem If you have a grammar like this: grammar org.xtext.example.mydsl.MyDsl with org.eclipse.xtext.common.Terminals generate myDsl "http://www.xtext.org/example/mydsl/MyDsl" Model: persons+=Person* ; Person: kind=TYPE ; enum TYPE : good | bad ; You will get a ClassCastException by unsing the ValueConverter. This happens because in org.eclipse.xtext.serializer.acceptor.SequenceFeeder.getToken(RuleCall, Object, INode) there is nobody taking care if it is a enum. Because of that for all assignments the ValueSerializer is used. org.eclipse.xtext.serializer.tokens.ValueSerializer.serializeAssignedValue(EObject, RuleCall, Object, INode, Acceptor) This causes the problem because there is no ValueConverter that can handle Enums. Instead of the ValueSerializer the EnumSerializer should be used in org.eclipse.xtext.serializer.acceptor.SequenceFeeder.getToken(RuleCall, Object, INode). The attached patch solves the problem. I have written an testcase but I could not find other testcases for the serializer independent from xbase of xtend2. @Moritz Please let me know where we should put common testcases for the serializer.
the patch looks fine; you can commit it if you want to
pushed to master.
thx Holger!
Closing all bugs that were set to RESOLVED before Neon.0