| Summary: | [Xtext] Serialization fails after quickfix insertion | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Modeling] TMF | Reporter: | Johan Wannheden <johan.wannheden> | ||||
| Component: | Xtext | Assignee: | Project Inbox <tmf.xtext-inbox> | ||||
| Status: | CLOSED FIXED | QA Contact: | |||||
| Severity: | normal | ||||||
| Priority: | P3 | CC: | moritz.eysholdt, sven.efftinge | ||||
| Version: | 0.7.0 | Flags: | moritz.eysholdt:
galileo+
|
||||
| Target Milestone: | RC3 | ||||||
| Hardware: | PC | ||||||
| OS: | Mac OS X - Carbon (unsup.) | ||||||
| Whiteboard: | |||||||
| Attachments: |
|
||||||
|
Description
Johan Wannheden
Created attachment 170200 [details]
Attaching the MyDsl project
> Note that the INT rule was overwritten to allow negative integer values. The
> default org.eclipse.xtext.conversion.impl.INTValueConverter value converter
> should be able to handle such values.
Nope, it's not...
org.eclipse.xtext.conversion.impl.INTValueConverter.assertValidValue(Integer):
-----
protected void assertValidValue(Integer value) {
super.assertValidValue(value);
if (value < 0)
throw new ValueConverterException(getRuleName() + "-value may not be negative (value:" + value + ").", null, null);
}
I assume that this exception is thrown which is then caught in org.eclipse.xtext.parsetree.reconstr.impl.ValueSerializer.isValid(EObject, RuleCall, Object, IErrorAcceptor) which then returns false and consequently causes serialization to fail.
Can you confirm this?
I don't think it would be a good idea to use the parser/lexer by default to validate int values... validating them as integers is so much more performant and straight forward.
in case serialization fails because of the reasons mentioned above, please adopt your ValueConverter.
You're quite right, it did turn out to be a value converter issue. Sorry for the noise. But still there error message sucks. It should have been the ValueConverterException which is shown to the user, shouldn't it? Another small follow-up question for something I noticed when fiddling with this: after application of a quickfix the textual model is formatted, but not using the formatter I have configured for my language - is that right? Should I file a bug? And yes Sven, a ValueConverterException was actually thrown, but never visible to the user, which is sub-optimal. Now the serialization exception mentions the messages from ValueConverterExceptions, if they have been a likely reason for serialization to fail. Closing bug which were set to RESOLVED before Eclipse Neon.0. |