-
Notifications
You must be signed in to change notification settings - Fork 383
Description
Presenting problem
Consider a concrete implementation of java.util.AbstractCollection, such as
ArrayList or ArrayDeque, and the data -2 & -1. The implementations both
inherit their toString method from AbstractCollection.
Scala JVM toString on an AbstractList instance containing the data prints out
[-2, -1]
. ScalaNative, and its ancestor ScalaJS print out [-2,-1]
. Note well
the missing space/blank after the comma.
Discussion
Little differences like this drive engineers nuts (well, further nuts!). Agreed, insert
standard developer's reply of "Don't parse output data!. The formats are unreliable
and subject to change!"
This defect needlessly complicates my writing of unit tests for SN ArrayDeque,
which I need to bring scalanative.regex up to date. Other developers
may experience this issue.
Fix
The fix is trivial and one character: adding blank to a mkstring().
After the proposed fix, ScalaNative test-all passes. As always, even though
the flaw has not previously been reported, either in SN or ScalaJS
there may be application code which breaks because of the fix.
If I do not hear of a good reason not to proceed in a day or two, I will submit
a PR, Fortune allowing...