mirror of
https://github.com/fankes/moshi.git
synced 2025-10-18 23:49:21 +08:00
Prepare for release 1.11.0.
This commit is contained in:
65
CHANGELOG.md
65
CHANGELOG.md
@@ -1,6 +1,67 @@
|
|||||||
Change Log
|
Change Log
|
||||||
==========
|
==========
|
||||||
|
|
||||||
|
## Version 1.11.0
|
||||||
|
|
||||||
|
_2020-10-04_
|
||||||
|
|
||||||
|
* New: Kotlin extension functions and properties. Use of these extensions is only possible from
|
||||||
|
Kotlin, and requires the Kotlin stdlib dependency. This release does not have any Kotlin
|
||||||
|
requirement and can be used Kotlin-free from Java.
|
||||||
|
|
||||||
|
```kotlin
|
||||||
|
/** Extension alternative to [Types.nextAnnotations()]. */
|
||||||
|
fun <reified T : Annotation> Set<Annotation>.nextAnnotations(): Set<Annotation>?
|
||||||
|
|
||||||
|
/** Extension alternative to [Types.getRawType()]. */
|
||||||
|
val Type.rawType: Class<*>
|
||||||
|
|
||||||
|
/** Extension alternative to [Types.arrayOf()]. */
|
||||||
|
fun KClass<*>.asArrayType(): GenericArrayType
|
||||||
|
|
||||||
|
/** Extension alternative to [Types.arrayOf()]. */
|
||||||
|
fun Type.asArrayType(): GenericArrayType
|
||||||
|
```
|
||||||
|
|
||||||
|
* New: Experimental Kotlin extensions. These depend on unreleased APIs and may break in a future
|
||||||
|
release of Kotlin. If you are comfortable with this, add `@ExperimentalStdlibApi` at the callsite
|
||||||
|
or add this argument to your Kotlin compiler: `"-Xopt-in=kotlin.ExperimentalStdlibApi"`.
|
||||||
|
|
||||||
|
```kotlin
|
||||||
|
/** Returns the adapter for [T]. */
|
||||||
|
inline fun <reified T> Moshi.adapter(): JsonAdapter<T>
|
||||||
|
|
||||||
|
/** Returns the adapter for [ktype]. */
|
||||||
|
fun <T> Moshi.adapter(ktype: KType): JsonAdapter<T>
|
||||||
|
|
||||||
|
/** Adds an adapter for [T]. */
|
||||||
|
inline fun <reified T> Moshi.Builder.addAdapter(adapter: JsonAdapter<T>): Moshi.Builder
|
||||||
|
|
||||||
|
/** Extension alternative to [Types.arrayOf()]. */
|
||||||
|
fun KType.asArrayType(): GenericArrayType
|
||||||
|
|
||||||
|
/** Extension alternative to [Types.subtypeOf()]. */
|
||||||
|
inline fun <reified T> subtypeOf(): WildcardType
|
||||||
|
|
||||||
|
/** Extension alternative to [Types.supertypeOf()]. */
|
||||||
|
inline fun <reified T> supertypeOf(): WildcardType
|
||||||
|
```
|
||||||
|
|
||||||
|
* New: `JsonReader.nextSource()`. This returns an Okio `BufferedSource` that streams the UTF-8
|
||||||
|
bytes of a JSON value. Use this to accept JSON values without decoding them, to delegate to
|
||||||
|
another JSON processor, or for streaming access to very large embedded values.
|
||||||
|
* New: `Moshi.Builder.addLast()`. Use this when installing widely-applicable adapter factories like
|
||||||
|
`KotlinJsonAdapterFactory`. Adapters registered with `add()` are preferred (in the order they
|
||||||
|
were added), followed by all adapters registered with `addLast()` (also in the order they were
|
||||||
|
added). This precedence is retained when `Moshi.newBuilder()` is used.
|
||||||
|
* New: `setTag()`, `tag()` methods on `JsonReader` and `JsonWriter`. Use these as a side-channel
|
||||||
|
between adapters and their uses. For example, a tag may be used to track use of unexpected
|
||||||
|
data in a custom adapter.
|
||||||
|
* Fix: Don't crash with a `StackOverflowError` decoding backward-referencing type variables in
|
||||||
|
Kotlin. This caused problems for parameterized types like `MyInterface<E : Enum<E>>`.
|
||||||
|
* Upgrade: [Okio 1.17.5][okio_1_7_5].
|
||||||
|
* Upgrade: [Kotlin 1.4.10][kotlin_1_4_10].
|
||||||
|
|
||||||
## Version 1.10.0
|
## Version 1.10.0
|
||||||
|
|
||||||
_2020-08-26_
|
_2020-08-26_
|
||||||
@@ -418,8 +479,10 @@ _2015-06-16_
|
|||||||
|
|
||||||
|
|
||||||
[dates_example]: https://github.com/square/moshi/blob/master/examples/src/main/java/com/squareup/moshi/recipes/ReadAndWriteRfc3339Dates.java
|
[dates_example]: https://github.com/square/moshi/blob/master/examples/src/main/java/com/squareup/moshi/recipes/ReadAndWriteRfc3339Dates.java
|
||||||
[rfc_7159]: https://tools.ietf.org/html/rfc7159
|
|
||||||
[gson]: https://github.com/google/gson
|
[gson]: https://github.com/google/gson
|
||||||
[jackson]: http://wiki.fasterxml.com/JacksonHome
|
[jackson]: http://wiki.fasterxml.com/JacksonHome
|
||||||
|
[kotlin_1_4_10]: https://github.com/JetBrains/kotlin/releases/tag/v1.4.10
|
||||||
[maven_provided]: https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html
|
[maven_provided]: https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html
|
||||||
[moshi_kotlin_docs]: https://github.com/square/moshi/blob/master/README.md#kotlin
|
[moshi_kotlin_docs]: https://github.com/square/moshi/blob/master/README.md#kotlin
|
||||||
|
[okio_1_7_5]: https://square.github.io/okio/changelog/#version-1175
|
||||||
|
[rfc_7159]: https://tools.ietf.org/html/rfc7159
|
||||||
|
12
README.md
12
README.md
@@ -623,12 +623,12 @@ The reflection adapter requires the following additional dependency:
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.squareup.moshi</groupId>
|
<groupId>com.squareup.moshi</groupId>
|
||||||
<artifactId>moshi-kotlin</artifactId>
|
<artifactId>moshi-kotlin</artifactId>
|
||||||
<version>1.9.3</version>
|
<version>1.11.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
```
|
```
|
||||||
|
|
||||||
```kotlin
|
```kotlin
|
||||||
implementation("com.squareup.moshi:moshi-kotlin:1.10.0")
|
implementation("com.squareup.moshi:moshi-kotlin:1.11.0")
|
||||||
```
|
```
|
||||||
|
|
||||||
Note that the reflection adapter transitively depends on the `kotlin-reflect` library which is a
|
Note that the reflection adapter transitively depends on the `kotlin-reflect` library which is a
|
||||||
@@ -658,13 +658,13 @@ add the following to your build to enable the annotation processor:
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.squareup.moshi</groupId>
|
<groupId>com.squareup.moshi</groupId>
|
||||||
<artifactId>moshi-kotlin-codegen</artifactId>
|
<artifactId>moshi-kotlin-codegen</artifactId>
|
||||||
<version>1.9.3</version>
|
<version>1.11.0</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
```
|
```
|
||||||
|
|
||||||
```kotlin
|
```kotlin
|
||||||
kapt("com.squareup.moshi:moshi-kotlin-codegen:1.9.3")
|
kapt("com.squareup.moshi:moshi-kotlin-codegen:1.11.0")
|
||||||
```
|
```
|
||||||
|
|
||||||
You must also have the `kotlin-stdlib` dependency on the classpath during compilation in order for
|
You must also have the `kotlin-stdlib` dependency on the classpath during compilation in order for
|
||||||
@@ -690,12 +690,12 @@ Download [the latest JAR][dl] or depend via Maven:
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.squareup.moshi</groupId>
|
<groupId>com.squareup.moshi</groupId>
|
||||||
<artifactId>moshi</artifactId>
|
<artifactId>moshi</artifactId>
|
||||||
<version>1.9.3</version>
|
<version>1.11.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
```
|
```
|
||||||
or Gradle:
|
or Gradle:
|
||||||
```kotlin
|
```kotlin
|
||||||
implementation("com.squareup.moshi:moshi:1.9.3")
|
implementation("com.squareup.moshi:moshi:1.11.0")
|
||||||
```
|
```
|
||||||
|
|
||||||
Snapshots of the development version are available in [Sonatype's `snapshots` repository][snap].
|
Snapshots of the development version are available in [Sonatype's `snapshots` repository][snap].
|
||||||
|
@@ -20,7 +20,7 @@ org.gradle.jvmargs=-XX:MaxMetaspaceSize=512m
|
|||||||
kapt.includeCompileClasspath=false
|
kapt.includeCompileClasspath=false
|
||||||
|
|
||||||
GROUP=com.squareup.moshi
|
GROUP=com.squareup.moshi
|
||||||
VERSION_NAME=1.11.0-SNAPSHOT
|
VERSION_NAME=1.11.0
|
||||||
POM_DESCRIPTION=A modern JSON API for Android and Java
|
POM_DESCRIPTION=A modern JSON API for Android and Java
|
||||||
POM_URL=https://github.com/square/moshi/
|
POM_URL=https://github.com/square/moshi/
|
||||||
POM_SCM_URL=https://github.com/square/moshi/
|
POM_SCM_URL=https://github.com/square/moshi/
|
||||||
|
Reference in New Issue
Block a user