From 1537e03b7794b9ec08cf43f6f7244aa7fc711992 Mon Sep 17 00:00:00 2001 From: jwilson Date: Sat, 28 May 2016 14:25:36 -0400 Subject: [PATCH] Update changelog for Moshi 1.2.0. --- CHANGELOG.md | 97 +++++++++++++++++++++++++++++++++------------------- README.md | 4 +-- 2 files changed, 63 insertions(+), 38 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 91c613f..5372afc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,56 +1,81 @@ Change Log ========== +## Version 1.2.0 + +_2016-05-28_ + + * New: Take advantage of Okio's new `Options` feature when reading field names and enum values. + This has a significant impact on performance. We measured parsing performance improve from 89k + ops/sec to 140k ops/sec on one benchmark on one machine. + * New: Upgrade to Okio 1.8.0. + + ```xml + + com.squareup.okio + okio + 1.8.0 + + ``` + + * New: Support types that lack no-argument constructors objects on Android releases prior to + Gingerbread. + * Fix: Add writer value overload for boxed booleans. Autoboxing resolves boxed longs and doubles + to `value(Number)`, but a boxed boolean would otherwise resolve to value(boolean) with an + implicit call to booleanValue() which has the potential to throw NPEs. + * Fix: Be more aggressive about canonicalizing types. + ## Version 1.1.0 _2016-01-19_ - * New: Support [RFC 7159][rfc_7159], the latest JSON specification. This removes the constraint - that the root value must be an array or an object. It may now take any value: array, object, - string, number, boolean, or null. Previously this was only permitted if the adapter was - configured to be lenient. - * New: Enum constants may be annotated with `@Json` to customize their encoded value. - * New: Create new builder from Moshi instance with `Moshi.newBuilder()`. - * New: `Types.getRawType()` and `Types.collectionElementType()` APIs to assist in defining generic - type adapter factories. + * New: Support [RFC 7159][rfc_7159], the latest JSON specification. This removes the constraint + that the root value must be an array or an object. It may now take any value: array, object, + string, number, boolean, or null. Previously this was only permitted if the adapter was + configured to be lenient. + * New: Enum constants may be annotated with `@Json` to customize their encoded value. + * New: Create new builder from Moshi instance with `Moshi.newBuilder()`. + * New: `Types.getRawType()` and `Types.collectionElementType()` APIs to assist in defining generic + type adapter factories. ## Version 1.0.0 _2015-09-27_ - * **API Change**: Replaced `new JsonReader()` with `JsonReader.of()` and `new JsonWriter()` with - `JsonWriter.of()`. If your code calls either of these constructors it will need to be updated to - call the static factory method instead. - * **API Change**: Don’t throw `IOException` on `JsonAdapter.toJson(T)`. Code that calls this method - may need to be fixed to no longer catch an impossible `IOException`. - * Fix: the JSON adapter for `Object` no longer fails when encountering `null` in the stream. - * New: `@Json` annotation can customize a field's name. This is particularly handy for fields whose - names are Java keywords, like `default` or `public`. - * New: `Rfc3339DateJsonAdapter` converts between a `java.util.Date` and a string formatted with - RFC 3339 (like `2015-09-26T18:23:50.250Z`). This class is in the new `moshi-adapters` subproject. - You will need to register this adapter if you want this date formatting behavior. See it in - action in the [dates example][dates_example]. - * New: `Moshi.adapter()` keeps a cache of all created adapters. For best efficiency, application - code should keep a reference to required adapters in a field. - * New: The `Types` factory class makes it possible to compose types like `List` or - `Map`. This is useful to look up JSON adapters for parameterized types. - * New: `JsonAdapter.failOnUnknown()` returns a new JSON adapter that throws if an unknonw value is - encountered on the stream. Use this in development and debug builds to detect typos in field - names. This feature shouldn’t be used in production because it makes migrations very difficult. + * **API Change**: Replaced `new JsonReader()` with `JsonReader.of()` and `new JsonWriter()` with + `JsonWriter.of()`. If your code calls either of these constructors it will need to be updated to + call the static factory method instead. + * **API Change**: Don’t throw `IOException` on `JsonAdapter.toJson(T)`. Code that calls this + method may need to be fixed to no longer catch an impossible `IOException`. + * Fix: the JSON adapter for `Object` no longer fails when encountering `null` in the stream. + * New: `@Json` annotation can customize a field's name. This is particularly handy for fields + whose names are Java keywords, like `default` or `public`. + * New: `Rfc3339DateJsonAdapter` converts between a `java.util.Date` and a string formatted with + RFC 3339 (like `2015-09-26T18:23:50.250Z`). This class is in the new `moshi-adapters` + subproject. You will need to register this adapter if you want this date formatting behavior. + See it in action in the [dates example][dates_example]. + * New: `Moshi.adapter()` keeps a cache of all created adapters. For best efficiency, application + code should keep a reference to required adapters in a field. + * New: The `Types` factory class makes it possible to compose types like `List` or + `Map`. This is useful to look up JSON adapters for parameterized types. + * New: `JsonAdapter.failOnUnknown()` returns a new JSON adapter that throws if an unknonw value is + encountered on the stream. Use this in development and debug builds to detect typos in field + names. This feature shouldn’t be used in production because it makes migrations very difficult. ## Version 0.9.0 _2015-06-16_ - * Databinding for primitive types, strings, enums, arrays, collections, and maps. - * Databinding for plain old Java objects. - * [JSONPath](http://goessner.net/articles/JsonPath/) support for both `JsonReader` and - `JsonWriter`. - * Throw `JsonDataException` when there’s a data binding problem. - * Adapter methods: `@ToJson` and `@FromJson`. - * Qualifier annotations: `@JsonQualifier` to permit different type adapters for the same Java type. - * Imported code from Gson: `JsonReader`, `JsonWriter`. Also some internal classes: - `LinkedHashTreeMap` for hash-collision avoidance and `Types` for typesafe databinding. + * Databinding for primitive types, strings, enums, arrays, collections, and maps. + * Databinding for plain old Java objects. + * [JSONPath](http://goessner.net/articles/JsonPath/) support for both `JsonReader` and + `JsonWriter`. + * Throw `JsonDataException` when there’s a data binding problem. + * Adapter methods: `@ToJson` and `@FromJson`. + * Qualifier annotations: `@JsonQualifier` to permit different type adapters for the same Java + type. + * Imported code from Gson: `JsonReader`, `JsonWriter`. Also some internal classes: + `LinkedHashTreeMap` for hash-collision avoidance and `Types` for typesafe databinding. [dates_example]: https://github.com/square/moshi/blob/master/examples/src/main/java/com/squareup/moshi/recipes/ReadAndWriteRfc3339Dates.java diff --git a/README.md b/README.md index 364ab92..b2827db 100644 --- a/README.md +++ b/README.md @@ -455,12 +455,12 @@ Download [the latest JAR][dl] or depend via Maven: com.squareup.moshi moshi - 1.1.0 + 1.2.0 ``` or Gradle: ```groovy -compile 'com.squareup.moshi:moshi:1.1.0' +compile 'com.squareup.moshi:moshi:1.2.0' ``` Snapshots of the development version are available in [Sonatype's `snapshots` repository][snap].