Community
Participate
Working Groups
Created attachment 167948 [details] Introduce immutable SaveOptions next to Resource in favor of mutable SerializerOptions The SerializerOptions are unfortunately mutable and require to handle the options map manually. The patch introduces xtext.resource.SaveOptions next to the XtextResource itself. The SaveOptions are immutable and encapsulate the read and write to the options map including full backwards compatibility. Furthermore there is a clear distinction between builder pattern for the options and the created instance. The SerializerOptions have been marked as deprecated. Please review.
All this effort for immutability? hm, ok. I'd rather have the Builder implement an opt-out for validation than to implement an opt-in. People that want formatting will write something like: SaveOptions.newBuilder().format().getOptions(); However, this will implicitly and unintentionally disable ConcreteSyntaxValidation. So if they stumble into Serializationexceptions they have no could why they are not getting better error messages. If someone doesn't want ConcreteSyntaxValidation he should need to write something like: SaveOptions.newBuilder().format().noValidation().getOptions();
Besides the opt-in issue, the patch looks ok to me.
Immutability and encapsulation. Both can be quite handy ;-) I'll modify the validate() to a noValidation() and commit the patch.
Fixed in HEAD.
Closing bug which were set to RESOLVED before Eclipse Neon.0.