Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 311906

Summary: [Serializer] Serializer class should be extendible
Product: [Modeling] TMF Reporter: Johan Wannheden <johan.wannheden>
Component: XtextAssignee: Project Inbox <tmf.xtext-inbox>
Status: CLOSED FIXED QA Contact:
Severity: enhancement    
Priority: P3 CC: moritz.eysholdt, sebastian.zarnekow, stephane, sven.efftinge
Version: 1.0.0Flags: sebastian.zarnekow: helios+
Target Milestone: RC1   
Hardware: PC   
OS: Mac OS X - Carbon (unsup.)   
Whiteboard:

Description Johan Wannheden CLA 2010-05-06 11:10:58 EDT
Build Identifier: 20100218-1602

In Serializer.java the following fields are defined:

	private IParseTreeConstructor parseTreeReconstructor;
	private IFormatter formatter;
	private IConcreteSyntaxValidator validator;
	
Why not make them protected?

Reproducible: Always
Comment 1 Sven Efftinge CLA 2010-05-06 11:17:05 EDT
The values are injected. You have to override the constructor anyway.
Comment 2 Stephane Barbey CLA 2010-05-06 11:30:28 EDT
This is right. However, if you want to use these private fields in your own subclass of Serializer, you must declare them again in it (and you see them twice in the debugger.)

And as you mention, they must appear in the constructor signature anyway.
Comment 3 Moritz Eysholdt CLA 2010-05-06 12:09:38 EDT
I agree that the fields should be protected instead of private or that there should be protected getter-methods to access these fields. But there are many more classes affected by this issue.
Comment 4 Sebastian Zarnekow CLA 2010-05-06 14:40:51 EDT
Fixed in HEAD.

We should do this for other places as well if we stumble accross fields / functionality that is not accessible / customizable in subclasses if we do not do any harm to existing consumers.

Johan, would you please be so kind and outline in a few words why you have the need to customize the serializer?
Comment 5 Johan Wannheden CLA 2010-05-07 04:32:55 EDT
We use our own routine to determine the initial indentation when creating the formatter stream (see SerializerUtil.java line 98 where null is used).
Comment 6 Stephane Barbey CLA 2010-05-07 10:18:15 EDT
(In reply to comment #4)
> We should do this for other places as well if we stumble accross fields /
> functionality that is not accessible / customizable in subclasses if we do not
> do any harm to existing consumers.

This is particularly true of implementations (like the Serializer in this case) that get bound by default.
Comment 7 Karsten Thoms CLA 2017-09-19 15:55:52 EDT
Closing bug which were set to RESOLVED before Eclipse Neon.0.