Bug 552035 - Unhelpful org.eclipse.xtext.util.EmfFormatter list index 'stabilization'
Summary: Unhelpful org.eclipse.xtext.util.EmfFormatter list index 'stabilization'
Status: NEW
Alias: None
Product: TMF
Classification: Modeling
Component: Xtext (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 10
: P3 minor (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: helpwanted
Depends on:
Blocks:
 
Reported: 2019-10-11 07:19 EDT by Ed Willink CLA
Modified: 2019-10-16 06:24 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ed Willink CLA 2019-10-11 07:19:26 EDT
EmfFormatter.printInt can stabilize the length of a formatted Integer, but unhelpfully this is used to stabilize the index of a list entry as in 

FamilyPlanning {
    cref SurnamePlan surnamePlans [
        0 : SurnamePlan {
            attr EString name 'Flanders'


For me, the sole use case of EmfFormatter is its excellent utility for comparing two models in a way that JUnit renders helpfully.

However if a 9-element list is compared with an 11-element list, all entries are reported as different because the "0" index is stabilized as the two digit "1 " to match the max length of any index.

Please remove the stabilization at line 118.

(Also at line 62 "innerIdent" should be "innerIndent").
Comment 1 Christian Dietrich CLA 2019-10-11 07:42:34 EDT
I am not sure if changing this would lead to semantic api changes and thus annoy people but maybe that could be done configurable
Comment 2 Ed Willink CLA 2019-10-11 08:20:56 EDT
Obviously any change is a semantic API breakage; it's just a matter of whether it's reasonable or not.

For the compare-equals use case, it makes no difference since equality of two serializations is unaffected. There is an issue of equality with a saved EmfFormatter serialization, but I have always avoided that since certainly I never regarded EMFFormatter as stable. I always compare EMFFormatter serializations of a new / old Resource not a new / old EMFFormatter serialization.

For the human browsing use case, the change is a fractional improvement, but EmfFormatter is not very good for humans anyway. I find an EMF tree or pure XMI better.

If you have other use cases and they are affected, then WONTFIX. If not it's a minor bug fix.
Comment 3 Sebastian Zarnekow CLA 2019-10-16 06:24:05 EDT
I think it wouldn't do any harm to add an option that allows to disable the padding.