discomarathon / google-gson

Automatically exported from code.google.com/p/google-gson
0 stars 0 forks source link

Add 'Appendable' as a destination for Gson #52

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Currently, Gson can generate a String or write to a Writer.  This can result in 
unnecessary temporary 
String objects when the user wants to embed Gson in a larger response.  Both 
StringBuilder and 
Writer share a common interface however: Appendable.  Since it is unlikely that 
the flush and close 
methods are called on Writer while serializing, consider either adding 
Appendable as a destination 
or replacing Writable with Appendable as the stream output type.

Original issue reported on code.google.com by complexm...@gmail.com on 1 Oct 2008 at 9:32

GoogleCodeExporter commented 9 years ago
Note that java.lang.Appendable first appeared in Java 1.5

Original comment by damiancarrillo on 6 Oct 2008 at 9:53

GoogleCodeExporter commented 9 years ago

Original comment by joel.leitch@gmail.com on 13 Oct 2008 at 7:26

GoogleCodeExporter commented 9 years ago
Fixed in r315

Note that this breaks backwards binary compatibility while preserving backwards
source compatibility. This is so because we changed the toJson() method 
signatures
instead of adding new methods. However, since Appendable is a super class of 
Writer,
a simple recompilation of code should be sufficient. Since this bug fix will go 
in a
major release, this is acceptable.

Original comment by inder123 on 26 Nov 2008 at 7:15

GoogleCodeExporter commented 9 years ago

Original comment by inder123 on 26 Nov 2008 at 7:15