Closed GoogleCodeExporter closed 9 years ago
Yes, this is not (yet?) implemented. Feel free to try to add the support.
1. Remove in the BaseRepresenter the check for arrays of primitives (line
100-103)
2. Run the tests to see what fails
3. Adapt SeqTagTest (and other tests) to work as you expect
4. Apply the new functionality in SnakeYAML to make it work
Some info:
a) the check in the BaseRepresenter is the last check before getting the
Representer for JavaBeans. There should be another way to detect the array and
the type of members (Strings should be dumped differently then integers)
b) SafeRepresenter shall get yet another implementation of interface Represent
in the 'representers' instance variable. See the examples: RepresentByteArray,
RepresentArray
c) check that the coverage is complete (mvn site)
Original comment by py4fun@gmail.com
on 28 Oct 2011 at 7:55
Does anyone already made this issue? It have not fixed yet in main repository
and I can't find in other repositories.
Original comment by ann.r...@gmail.com
on 18 Mar 2013 at 2:52
I don't think so. Be the One ;)
Original comment by alexande...@gmail.com
on 19 Mar 2013 at 6:30
I think I've fixed this issue (patch attached).
I have added a new test case, org.yaml.snakeyaml.array.PrimitiveArrayTest,
which tests several use-cases for primitive arrays: loading, representing,
truncating values (e.g. float->int) and promoting values (e.g. int->double).
With some modifications to SafeConstructor, BaseRepresenter, SafeRepresenter,
and Representer, the test passes. A new RepresentPrimitiveArray has been
introduced, and SafeConstructor.createArray() and
SafeConstructor.constructArrayStep2() have been patched to handle arrays of all
primitive types.
Some test cases checked for the old "Arrays of primitives not fully supported"
error message and were removed.
Code coverage looks good. There are a few lines which are not covered, such as
checks for unexpected primitive types (which cannot be tested unless a new
primitive type is introduced). These follow a pattern used elsewhere, such as
in Constructor.wrapIfPrimitive().
Comments/criticism welcome. I'd like to apply this patch to main soon.
Original comment by JordanAn...@gmail.com
on 11 Apr 2013 at 5:48
Attachments:
Thank you Jordan !
I think you forgot to include the test in the patch. (You can also create a
remote repository.)
Original comment by py4fun@gmail.com
on 11 Apr 2013 at 6:37
I'm pretty sure the test is included in the patch, under
org.yaml.snakeyaml.array.PrimitiveArrayTest . Did you want it under
issues.issue135 instead?
I also realized that multi-dimensional arrays were not supported by that last
patch. I've added some new cases to the test for long[][], long[][][], and
array-of-objects-which-have-arrays, and have added those changes as 1465.patch
(attached).
Original comment by JordanAn...@gmail.com
on 11 Apr 2013 at 7:33
Attachments:
Weird. I see PrimitiveArrayTest in the patch, but it was not created in the
working directory.
I think the 'array' package is better. This is sure no bug.
Original comment by py4fun@gmail.com
on 11 Apr 2013 at 9:36
Are there any objections to me committing that change? I'd like to commit soon,
before I forget about this.
Original comment by JordanAn...@gmail.com
on 15 Apr 2013 at 7:24
No objection from me ;)
Original comment by alexande...@gmail.com
on 16 Apr 2013 at 9:52
Feel free to commit.
Original comment by py4fun@gmail.com
on 16 Apr 2013 at 11:45
Original comment by JordanAn...@gmail.com
on 16 Apr 2013 at 6:38
Original issue reported on code.google.com by
bors...@gmail.com
on 27 Oct 2011 at 2:46