Community
Participate
Working Groups
Build Identifier: I20100608-0911 Assume an xtext grammar derived from the default terminal grammar: grammar Foo with org.eclipse.xtext.common.Terminals which then re-defines the STRING rule, for instance to use Ada (or PL/SQL) style strings: terminal STRING : ('"' ((!'"')|('"' '"'))* '"'); Then write a value converter for this: class FooValueConverters extends org.eclipse.xtext.common.services.DefaultTerminalConverters { @ValueConverter(rule = "STRING") public IValueConverter<String> stringValueConverter() { return new AbstractNullSafeConverter<String>() { @Override protected String internalToValue(String s, AbstractNode node) { return return s.substring(1, s.length() - 1).replace("\"\"", "\"");; } @Override protected String internalToString(String value) { return '"' + source.replace("\"", "\"\"") + '"'; } }; } Then inject this value converter. When this value converter is set up, the implementation in AbstractDeclarativeValueConverterService.internalRegisterForClass will first register this new STRING value converter, and then override it by the default one from org.eclipse.xtext.common.services.DefaultTerminalConverters, from which FooValueConverters is extended. As a result, a string like "bar""" cannot be serialized. The fix is simple: in internalRegisterForClass, handle superclasses first before checking and registering the methods of the current class. Reproducible: Always
Fixed in HEAD.
Closing bug which were set to RESOLVED before Eclipse Neon.0.