-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Gson.fromJson(..., TypeToken) overloads #1700
Conversation
Previously only Gson.fromJson(..., Type) existed which is however not type-safe since the generic type parameter T used for the return type is not bound. Since these methods are often used in the form gson.fromJson(..., new TypeToken<...>(){}.getType()) this commit now adds overloads which accept a TypeToken and are therefore more type-safe. Additional changes: - Fixed some grammar mistakes - Added javadoc @see tags - Consistently write "JSON" in uppercase - More precise placement of @SuppressWarnings("unchecked")
The newly added documentation deliberately does not state which exception is thrown because Gson.assertFullConsumption could throw either a JsonIOException or a JsonSyntaxException.
e5bf28f
to
789bb16
Compare
Since the actual implementation of Gson.fromJson is TypeToken based, the TypeToken variant overloads are now the "main" implementation and the other overloads delegate to them. Previously the Type variant overloads were the "main" implementation which caused `TypeToken.getType()` followed by `TypeToken.get(...)` when the TypeToken variant overloads were used.
To be consistent with the other Gson.fromJson(..., Class) overloads the method should cast the result.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This makes sense to me, and I don't know why the idea was summarily dismissed in 2010. The main drawback I see is that new TypeToken<List<String>>() {}
is an object allocation and an additional anonymous subclass, but you already have that if you're currently getting a Type
from the same expression with .getType()
on the end.
I'm running the change against all of Google's internal Gson client code just in case the new overload introduces some compilation problem, though I can't really see what that would be.
@@ -76,26 +76,30 @@ | |||
* <pre> | |||
* Gson gson = new Gson(); // Or use new GsonBuilder().create(); | |||
* MyType target = new MyType(); | |||
* String json = gson.toJson(target); // serializes target to Json | |||
* String json = gson.toJson(target); // serializes target to JSON | |||
* MyType target2 = gson.fromJson(json, MyType.class); // deserializes json into target2 | |||
* </pre> | |||
* | |||
* <p>If the object that your are serializing/deserializing is a {@code ParameterizedType} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could fix the typo "your" here while you are at it.
* {@link #toJson(Object, Type)} or {@link #fromJson(String, Type)} method. Here is an | ||
* example for serializing and deserializing a {@code ParameterizedType}: | ||
* | ||
* {@link #toJson(Object, Type)} or {@link #fromJson(String, TypeToken)} method. Gson provides |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the text says "you must use", I think it should detail all the options, so both Type
and TypeToken
overloads. There may be cases where it is still preferable to use the Type
one. TypeToken
could come first, though, and the example show just that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have reworded the whole paragraph a bit because it was also incorrect regarding serialization. I hope the new wording is fine; though please let me know if I should adjust something.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there should probably be at least a couple of new test methods covering the new overloads.
It appears there is unfortunately no other solution to this until the Java language gets proper compiler support for this (similar to Kotlin's reified type parameters?). Guava with its However, you can safely store the
Fair point; I have added them to Also, should there be |
05e6558
to
43ebe28
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New test code looks good! Just one more thing...
* @see #fromJson(Reader, Class) | ||
* @see #fromJson(JsonReader, TypeToken) | ||
*/ | ||
public <T> T fromJson(JsonReader reader, Class<T> classOfT) throws JsonIOException, JsonSyntaxException { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps surprisingly, this is not a source-compatible change. It seems completely logical to add this overload to the other fromJson(JsonReader...)
ones, but there's an issue. When I ran this PR against all of Google's builds, I encountered this:
private static <ResponseT extends ApiMessage> ApiMessageHttpResponseParser<ResponseT> create(
final ResponseT responseInstance) {
final Gson baseGson = new GsonBuilder().create();
TypeAdapter responseTypeAdapter;
Gson responseMarshaller = null;
if (responseInstance != null) {
responseTypeAdapter =
new TypeAdapter<ResponseT>() {
@Override
public void write(JsonWriter out, ResponseT value) {
baseGson.toJson(value, responseInstance.getClass(), out);
}
@Override
public ResponseT read(JsonReader in) {
return baseGson.fromJson(in, responseInstance.getClass());
}
};
This is not type-safe. The type of responseInstance.getClass()
is Class<? extends ApiMessage>
, and ? extends ApiMessage
is not assignable to ResponseT
. It compiles without this PR because there is no Class<T>
overload so it gets the type-unsafe Type
overload.
If the code here instead had return baseGson.fromJson(in, new TypeToken<ResponseT>() {}.getType())
then it would compile, with or without this PR, and then with this PR the .getType()
can be removed. It also looks as if this class no longer exists in the current version of gax-java
.
I found a second problem with code that was calling this method with Map.class
. The unchecked conversion from raw Map
to Map<String, ?>
drew a warning, and the code was being compiled with -Werror
. The same kind of fix applies, of course.
On the whole, I think we should drop this overload. It's probably better to retain the minor inconsistency of not having it than to expose users to new problems.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for running it against all Google builds.
If the code here instead had
return baseGson.fromJson(in, new TypeToken<ResponseT>() {}.getType())
then it would compile
But it would not be type safe either, in fact it would even be less type safe than the original code respectively not work properly at all because it would parse the JSON data as the erasure of the type variable (ApiMessage
). This is why it would have been good to fix #1219, and why I had this originally in #2072 😕. The previous code would not have been type safe though in case ResponseT
was a parameterized type.
I found a second problem with code that was calling this method with
Map.class
. The unchecked conversion from rawMap
toMap<String, ?>
drew a warning
For what it is worth this would not have been safe either. Even though one might expect that a raw Map
can only be deserialized to a Map<String, ...>
due to JSON only permitting strings as member names, Gson actually supports non string values as seen with #1247.
So yes, this will break source compatibility, but it might get users to write safer code, or at least become aware that their code is not safe and then manually suppress the compiler warnings. Therefore, personally I think it might be acceptable to break source compatibility here; but maybe there are cases where the existing code is actually safe and this would create too much trouble...
If you really want, I can remove it though.
(This also goes into the same direction why I mentioned in the description of this pull request to consider deprecating the fromJson(..., Type)
overloads. That would be rather extreme, but maybe it could be considered at some point in the future.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, the title of this PR is Add Gson.fromJson(..., TypeToken) overloads, so perhaps we can keep it focused on that. If you want to make a separate PR that adds fromJson(JsonReader, Class<T>)
then we can debate the source-incompatibility problem there.
The situation is a bit different from #2072, in that already-compiled code will continue to work. It's only new compilations that might fail, and probably only when the code being compiled is doing type-unsafe things. So I think there's a stronger case to be made for the change. Nevertheless, I think it should be separate, if only so I can prepare Google's code-base by fixing the problems I mentioned.
Regarding the type-safety of the first problem, I think the underlying issue is that the method doesn't have enough information to behave correctly. It would need to have something like a Class<ResponseT>
parameter, and then of course that could be correctly passed to the existing Type
overload, or to the new Class<T>
overload. I agree that the new Class<T>
overload makes it possible to discover this problem, while the new TypeToken<T>
overload just gives us a different way to sweep the unsoundness under the carpet. I further agree that ideally we would simply fix #1219 to disallow that unsoundness. I haven't changed my mind since #2072, though: I still feel that it's extremely important that people can update their Gson dependency without breaking things that currently work. I'll add that this would be yet another case where a compatibility-level concept might allow us to fix the errors of the past.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right, I have removed the method again and hope the changes are fine like that.
Sorry for being a bit relentlessly. It is just pretty frustrating and annoying knowing that there are bugs / flaws with Gson and seeing that they cannot be fixed or wasting work on trying to fix them. This is of course not your fault, and I think it is quite valuable that you have a different view of maintaining a library as popular as Gson.
I forgot to answer the question about |
As noticed during review adding this method is source incompatible.
7bf72a8
to
6ad87f0
Compare
Thanks for your patience, and for all the hard work you've put into this PR! |
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Type | Update | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---|---|---| | [gradle](https://gradle.org) ([source](https://togithub.com/gradle/gradle)) | | minor | `7.5.1` -> `7.6` | [![age](https://badges.renovateapi.com/packages/gradle-version/gradle/7.6/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/gradle-version/gradle/7.6/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/gradle-version/gradle/7.6/compatibility-slim/7.5.1)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/gradle-version/gradle/7.6/confidence-slim/7.5.1)](https://docs.renovatebot.com/merge-confidence/) | | [org.mockito:mockito-inline](https://togithub.com/mockito/mockito) | dependencies | minor | `4.8.0` -> `4.9.0` | [![age](https://badges.renovateapi.com/packages/maven/org.mockito:mockito-inline/4.9.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/maven/org.mockito:mockito-inline/4.9.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/maven/org.mockito:mockito-inline/4.9.0/compatibility-slim/4.8.0)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/maven/org.mockito:mockito-inline/4.9.0/confidence-slim/4.8.0)](https://docs.renovatebot.com/merge-confidence/) | | [org.mockito:mockito-junit-jupiter](https://togithub.com/mockito/mockito) | dependencies | minor | `4.8.0` -> `4.9.0` | [![age](https://badges.renovateapi.com/packages/maven/org.mockito:mockito-junit-jupiter/4.9.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/maven/org.mockito:mockito-junit-jupiter/4.9.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/maven/org.mockito:mockito-junit-jupiter/4.9.0/compatibility-slim/4.8.0)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/maven/org.mockito:mockito-junit-jupiter/4.9.0/confidence-slim/4.8.0)](https://docs.renovatebot.com/merge-confidence/) | | [org.mockito:mockito-core](https://togithub.com/mockito/mockito) | dependencies | minor | `4.8.0` -> `4.9.0` | [![age](https://badges.renovateapi.com/packages/maven/org.mockito:mockito-core/4.9.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/maven/org.mockito:mockito-core/4.9.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/maven/org.mockito:mockito-core/4.9.0/compatibility-slim/4.8.0)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/maven/org.mockito:mockito-core/4.9.0/confidence-slim/4.8.0)](https://docs.renovatebot.com/merge-confidence/) | | [com.github.ben-manes.caffeine:caffeine](https://togithub.com/ben-manes/caffeine) | dependencies | patch | `3.1.1` -> `3.1.2` | [![age](https://badges.renovateapi.com/packages/maven/com.github.ben-manes.caffeine:caffeine/3.1.2/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/maven/com.github.ben-manes.caffeine:caffeine/3.1.2/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/maven/com.github.ben-manes.caffeine:caffeine/3.1.2/compatibility-slim/3.1.1)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/maven/com.github.ben-manes.caffeine:caffeine/3.1.2/confidence-slim/3.1.1)](https://docs.renovatebot.com/merge-confidence/) | | [com.google.code.gson:gson](https://togithub.com/google/gson) | dependencies | minor | `2.9.1` -> `2.10` | [![age](https://badges.renovateapi.com/packages/maven/com.google.code.gson:gson/2.10/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/maven/com.google.code.gson:gson/2.10/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/maven/com.google.code.gson:gson/2.10/compatibility-slim/2.9.1)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/maven/com.google.code.gson:gson/2.10/confidence-slim/2.9.1)](https://docs.renovatebot.com/merge-confidence/) | | [net.kyori:adventure-text-serializer-gson](https://togithub.com/KyoriPowered/adventure) | dependencies | minor | `4.11.0` -> `4.12.0` | [![age](https://badges.renovateapi.com/packages/maven/net.kyori:adventure-text-serializer-gson/4.12.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/maven/net.kyori:adventure-text-serializer-gson/4.12.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/maven/net.kyori:adventure-text-serializer-gson/4.12.0/compatibility-slim/4.11.0)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/maven/net.kyori:adventure-text-serializer-gson/4.12.0/confidence-slim/4.11.0)](https://docs.renovatebot.com/merge-confidence/) | | [net.kyori:adventure-text-serializer-legacy](https://togithub.com/KyoriPowered/adventure) | dependencies | minor | `4.11.0` -> `4.12.0` | [![age](https://badges.renovateapi.com/packages/maven/net.kyori:adventure-text-serializer-legacy/4.12.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/maven/net.kyori:adventure-text-serializer-legacy/4.12.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/maven/net.kyori:adventure-text-serializer-legacy/4.12.0/compatibility-slim/4.11.0)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/maven/net.kyori:adventure-text-serializer-legacy/4.12.0/confidence-slim/4.11.0)](https://docs.renovatebot.com/merge-confidence/) | | [net.kyori:adventure-text-minimessage](https://togithub.com/KyoriPowered/adventure) | dependencies | minor | `4.11.0` -> `4.12.0` | [![age](https://badges.renovateapi.com/packages/maven/net.kyori:adventure-text-minimessage/4.12.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/maven/net.kyori:adventure-text-minimessage/4.12.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/maven/net.kyori:adventure-text-minimessage/4.12.0/compatibility-slim/4.11.0)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/maven/net.kyori:adventure-text-minimessage/4.12.0/confidence-slim/4.11.0)](https://docs.renovatebot.com/merge-confidence/) | | [net.kyori:adventure-api](https://togithub.com/KyoriPowered/adventure) | dependencies | minor | `4.11.0` -> `4.12.0` | [![age](https://badges.renovateapi.com/packages/maven/net.kyori:adventure-api/4.12.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/maven/net.kyori:adventure-api/4.12.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/maven/net.kyori:adventure-api/4.12.0/compatibility-slim/4.11.0)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/maven/net.kyori:adventure-api/4.12.0/confidence-slim/4.11.0)](https://docs.renovatebot.com/merge-confidence/) | | [org.jetbrains.kotlin.kapt](https://kotlinlang.org/) ([source](https://togithub.com/JetBrains/kotlin)) | plugin | minor | `1.6.21` -> `1.7.21` | [![age](https://badges.renovateapi.com/packages/maven/org.jetbrains.kotlin.kapt/1.7.21/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/maven/org.jetbrains.kotlin.kapt/1.7.21/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/maven/org.jetbrains.kotlin.kapt/1.7.21/compatibility-slim/1.6.21)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/maven/org.jetbrains.kotlin.kapt/1.7.21/confidence-slim/1.6.21)](https://docs.renovatebot.com/merge-confidence/) | | [org.jetbrains.kotlin.jvm](https://kotlinlang.org/) ([source](https://togithub.com/JetBrains/kotlin)) | plugin | patch | `1.7.20` -> `1.7.21` | [![age](https://badges.renovateapi.com/packages/maven/org.jetbrains.kotlin.jvm/1.7.21/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/maven/org.jetbrains.kotlin.jvm/1.7.21/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/maven/org.jetbrains.kotlin.jvm/1.7.21/compatibility-slim/1.7.20)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/maven/org.jetbrains.kotlin.jvm/1.7.21/confidence-slim/1.7.20)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>mockito/mockito</summary> ### [`v4.9.0`](https://togithub.com/mockito/mockito/releases/tag/v4.9.0) <sup><sup>*Changelog generated by [Shipkit Changelog Gradle Plugin](https://togithub.com/shipkit/shipkit-changelog)*</sup></sup> ##### 4.9.0 - 2022-11-14 - [6 commit(s)](https://togithub.com/mockito/mockito/compare/v4.8.1...v4.9.0) by Andrei Solntsev, Rafael Winterhalter, Rick Ossendrijver, dependabot\[bot] - Upgrade objenesis 3.2 -> 3.3 [(#​2784)](https://togithub.com/mockito/mockito/pull/2784) - Upgrade objenesis 3.2 -> 3.3 [(#​2783)](https://togithub.com/mockito/mockito/issues/2783) - Avoids clearing stale weak entries from critical code segments. [(#​2780)](https://togithub.com/mockito/mockito/pull/2780) - bump gradle from 7.3.1 to 7.5.1 [(#​2776)](https://togithub.com/mockito/mockito/pull/2776) - Bump gradle/wrapper-validation-action from 1.0.4 to 1.0.5 [(#​2775)](https://togithub.com/mockito/mockito/pull/2775) - Bump gradle-errorprone-plugin from 2.0.2 to 3.0.1 [(#​2770)](https://togithub.com/mockito/mockito/pull/2770) - Bump junit-platform-launcher from 1.9.0 to 1.9.1 [(#​2768)](https://togithub.com/mockito/mockito/pull/2768) ### [`v4.8.1`](https://togithub.com/mockito/mockito/releases/tag/v4.8.1) [Compare Source](https://togithub.com/mockito/mockito/compare/v4.8.0...v4.8.1) <sup><sup>*Changelog generated by [Shipkit Changelog Gradle Plugin](https://togithub.com/shipkit/shipkit-changelog)*</sup></sup> ##### 4.8.1 - 2022-10-17 - [6 commit(s)](https://togithub.com/mockito/mockito/compare/v4.8.0...v4.8.1) by andrepaschoal, dependabot\[bot] - Possible fix [#​2765](https://togithub.com/mockito/mockito/issues/2765): Add task to download package-list file from java as element-list [(#​2766)](https://togithub.com/mockito/mockito/pull/2766) - JavaDoc warning is blocking all pull requests [(#​2765)](https://togithub.com/mockito/mockito/issues/2765) - Bump versions.junitJupiter from 5.9.0 to 5.9.1 [(#​2758)](https://togithub.com/mockito/mockito/pull/2758) - Bump groovy from 3.0.12 to 3.0.13 [(#​2756)](https://togithub.com/mockito/mockito/pull/2756) - Bump com.diffplug.spotless from 6.10.0 to 6.11.0 [(#​2753)](https://togithub.com/mockito/mockito/pull/2753) - Bump org.eclipse.osgi from 3.18.0 to 3.18.100 [(#​2751)](https://togithub.com/mockito/mockito/pull/2751) - Bump versions.bytebuddy from 1.12.14 to 1.12.16 [(#​2747)](https://togithub.com/mockito/mockito/pull/2747) </details> <details> <summary>ben-manes/caffeine</summary> ### [`v3.1.2`](https://togithub.com/ben-manes/caffeine/releases/tag/v3.1.2) Cache - Added detection for when a key's equality has changed and corrupted the underlying map ([SOLR-16489]) - Improved the frequency sketch by better utilizing the cpu cache line to reduce memory accesses - Fixed `computeIfAbsent` when replacing a collected weak/soft value and the custom expiry fails - Improved refresh conflict detection to avoid unnecessarily discarding after a reload - Improved eviction when the weight is oversized ([#​745](https://togithub.com/ben-manes/caffeine/issues/745)) Guava - Added an adapter from Guava's CacheLoader to Caffeine's ([#​766](https://togithub.com/ben-manes/caffeine/issues/766)) JCache - Fixed `Cache.getConfiguration()` to return an immutable instance [SOLR-16489]: https://togithub.com/apache/solr/pull/1118 </details> <details> <summary>google/gson</summary> ### [`v2.10`](https://togithub.com/google/gson/blob/HEAD/CHANGELOG.md#Version-210) - Support for serializing and deserializing Java records, on Java ≥ 16. ([https://github.com/google/gson/pull/2201](https://togithub.com/google/gson/pull/2201)) - Add `JsonArray.asList` and `JsonObject.asMap` view methods ([https://github.com/google/gson/pull/2225](https://togithub.com/google/gson/pull/2225)) - Fix `TypeAdapterRuntimeTypeWrapper` not detecting reflective `TreeTypeAdapter` and `FutureTypeAdapter` ([https://github.com/google/gson/pull/1787](https://togithub.com/google/gson/pull/1787)) - Improve `JsonReader.skipValue()` ([https://github.com/google/gson/pull/2062](https://togithub.com/google/gson/pull/2062)) - Perform numeric conversion for primitive numeric type adapters ([https://github.com/google/gson/pull/2158](https://togithub.com/google/gson/pull/2158)) - Add `Gson.fromJson(..., TypeToken)` overloads ([https://github.com/google/gson/pull/1700](https://togithub.com/google/gson/pull/1700)) - Fix changes to `GsonBuilder` affecting existing `Gson` instances ([https://github.com/google/gson/pull/1815](https://togithub.com/google/gson/pull/1815)) - Make `JsonElement` conversion methods more consistent and fix javadoc ([https://github.com/google/gson/pull/2178](https://togithub.com/google/gson/pull/2178)) - Throw `UnsupportedOperationException` when `JsonWriter.jsonValue` is not supported ([https://github.com/google/gson/pull/1651](https://togithub.com/google/gson/pull/1651)) - Disallow `JsonObject` `Entry.setValue(null)` ([https://github.com/google/gson/pull/2167](https://togithub.com/google/gson/pull/2167)) - Fix `TypeAdapter.toJson` throwing AssertionError for custom IOException ([https://github.com/google/gson/pull/2172](https://togithub.com/google/gson/pull/2172)) - Convert null to JsonNull for `JsonArray.set` ([https://github.com/google/gson/pull/2170](https://togithub.com/google/gson/pull/2170)) - Fixed nullSafe usage. ([https://github.com/google/gson/pull/1555](https://togithub.com/google/gson/pull/1555)) - Validate `TypeToken.getParameterized` arguments ([https://github.com/google/gson/pull/2166](https://togithub.com/google/gson/pull/2166)) - Fix [#​1702](https://togithub.com/google/gson/issues/1702): Gson.toJson creates CharSequence which does not implement toString ([https://github.com/google/gson/pull/1703](https://togithub.com/google/gson/pull/1703)) - Prefer existing adapter for concurrent `Gson.getAdapter` calls ([https://github.com/google/gson/pull/2153](https://togithub.com/google/gson/pull/2153)) - Improve `ArrayTypeAdapter` for `Object[]` ([https://github.com/google/gson/pull/1716](https://togithub.com/google/gson/pull/1716)) - Improve `AppendableWriter` performance ([https://github.com/google/gson/pull/1706](https://togithub.com/google/gson/pull/1706)) </details> <details> <summary>KyoriPowered/adventure</summary> ### [`v4.12.0`](https://togithub.com/KyoriPowered/adventure/releases/tag/v4.12.0): 🌏 Adventure 4.12.0 This release, at long last, adds API to help work with the 1.19(.x) chat and sound changes, including sending messages with the new chat type system. Due to the strict lifecycle of message signing, implementing the full chat flow will be mostly left to platforms. The exposed signed message API is intended for use with out-of-band operations like signed commands. Thank you for your patience! ##### Additions ✨ - feature: 1.19 chat changes by [@​kezz](https://togithub.com/kezz) in [https://github.com/KyoriPowered/adventure/pull/777](https://togithub.com/KyoriPowered/adventure/pull/777) - Implement seed field on sound, and add a builder by [@​zml2008](https://togithub.com/zml2008) in [https://github.com/KyoriPowered/adventure/pull/770](https://togithub.com/KyoriPowered/adventure/pull/770) - key: Make Key implement Keyed by [@​zml2008](https://togithub.com/zml2008) in [https://github.com/KyoriPowered/adventure/pull/779](https://togithub.com/KyoriPowered/adventure/pull/779) - Promote decorationIfAbsent to StyleSetter and Public API by [@​KingOfSquares](https://togithub.com/KingOfSquares) in [https://github.com/KyoriPowered/adventure/pull/785](https://togithub.com/KyoriPowered/adventure/pull/785) - Add convenience methods for appending a newline/space to a component by [@​KingOfSquares](https://togithub.com/KingOfSquares) in [https://github.com/KyoriPowered/adventure/pull/786](https://togithub.com/KyoriPowered/adventure/pull/786) - feat(key): [#​773](https://togithub.com/KyoriPowered/adventure/issues/773) Expose methods to check if a Key can be parsed by [@​kashike](https://togithub.com/kashike) in [https://github.com/KyoriPowered/adventure/pull/774](https://togithub.com/KyoriPowered/adventure/pull/774) - api: Style#unmerge by [@​kashike](https://togithub.com/kashike) in [https://github.com/KyoriPowered/adventure/pull/793](https://togithub.com/KyoriPowered/adventure/pull/793) ##### Fixes 🐛 - api: Remove use of terminally deprecated SecurityManager api by [@​zml2008](https://togithub.com/zml2008) in [https://github.com/KyoriPowered/adventure/pull/781](https://togithub.com/KyoriPowered/adventure/pull/781) - api: Fix improper stripping of colors when compacting by [@​zml2008](https://togithub.com/zml2008) in [https://github.com/KyoriPowered/adventure/pull/782](https://togithub.com/KyoriPowered/adventure/pull/782) - bug([#​788](https://togithub.com/KyoriPowered/adventure/issues/788)): disable html escaping and use uppercase hex colour codes by [@​kashike](https://togithub.com/kashike) in [https://github.com/KyoriPowered/adventure/pull/789](https://togithub.com/KyoriPowered/adventure/pull/789) - minimessage: Parsing corner cases with quotes by [@​rymiel](https://togithub.com/rymiel) in [https://github.com/KyoriPowered/adventure/pull/819](https://togithub.com/KyoriPowered/adventure/pull/819) - fix(text-minimessage): Don't strip style of text components in gradients by [@​zml2008](https://togithub.com/zml2008) in [https://github.com/KyoriPowered/adventure/pull/835](https://togithub.com/KyoriPowered/adventure/pull/835) - fix(text-minimessage): Preserve non-text components in color changing tags by [@​zml2008](https://togithub.com/zml2008) in [https://github.com/KyoriPowered/adventure/pull/834](https://togithub.com/KyoriPowered/adventure/pull/834) - fix(text-minimessage): Be more lenient with input when stripping/escaping tags by [@​zml2008](https://togithub.com/zml2008) in [https://github.com/KyoriPowered/adventure/pull/833](https://togithub.com/KyoriPowered/adventure/pull/833) - fix(text-minimessage): Properly handle escaped tag opens by [@​zml2008](https://togithub.com/zml2008) in [https://github.com/KyoriPowered/adventure/pull/832](https://togithub.com/KyoriPowered/adventure/pull/832) - fix(api): Catch cases where empty components are not preserved by [@​zml2008](https://togithub.com/zml2008) in [https://github.com/KyoriPowered/adventure/pull/838](https://togithub.com/KyoriPowered/adventure/pull/838) - bug([https://github.com/KyoriPowered/adventure/issues/792](https://togithub.com/KyoriPowered/adventure/issues/792)): don't throw on invalid click/hover event action by [@​kashike](https://togithub.com/kashike) in https://github.com/KyoriPowered/adventure/commit/1c2463fce400e91ad92de9e7d7466b4b95dad4ae - bug(api): fix an issue when linearly building a component by [@​kashike](https://togithub.com/kashike) in https://github.com/KyoriPowered/adventure/commit/7bb187593c92ad1ddb77e761736d7b64a1171bac ##### Platform Changes 🔧 - Add PlatformAPI Annotation by [@​KingOfSquares](https://togithub.com/KingOfSquares) in [https://github.com/KyoriPowered/adventure/pull/778](https://togithub.com/KyoriPowered/adventure/pull/778) - feat(api): bossbar platform implementation by [@​kashike](https://togithub.com/kashike) in [https://github.com/KyoriPowered/adventure/pull/836](https://togithub.com/KyoriPowered/adventure/pull/836) **Full Changelog**: https://github.com/KyoriPowered/adventure/compare/v4.11.0...v4.12.0 </details> <details> <summary>JetBrains/kotlin</summary> ### [`v1.7.21`](https://togithub.com/JetBrains/kotlin/blob/HEAD/ChangeLog.md#​1721) ##### Compiler - [`KT-54463`](https://youtrack.jetbrains.com/issue/KT-54463) Delegating to a field with a platform type causes java.lang.NoSuchFieldError: value$delegate - [`KT-54509`](https://youtrack.jetbrains.com/issue/KT-54509) Ir Interpreter: unable to evaluate string concatenation with "this" as argument - [`KT-54004`](https://youtrack.jetbrains.com/issue/KT-54004) Builder type inference does not work correctly with variable assignment and breaks run-time - [`KT-54393`](https://youtrack.jetbrains.com/issue/KT-54393) Change in behavior from 1.7.10 to 1.7.20 for java field override. - [`KT-54615`](https://youtrack.jetbrains.com/issue/KT-54615) JVM: Internal error in file lowering: java.lang.AssertionError: Error occurred while optimizing an expression - [`KT-54581`](https://youtrack.jetbrains.com/issue/KT-54581) JVM: "VerifyError: Bad type on operand stack" with generic inline function and `when` inside try-catch block - [`KT-53146`](https://youtrack.jetbrains.com/issue/KT-53146) JVM IR: unnecessary checkcast of null leads to NoClassDefFoundError if the type isn't available at runtime - [`KT-54600`](https://youtrack.jetbrains.com/issue/KT-54600) NPE on passing nullable Kotlin lambda as Java's generic SAM interface with `super` type bound - [`KT-54707`](https://youtrack.jetbrains.com/issue/KT-54707) "VerifyError: Bad type on operand stack" in inline call chain on a nullable array value - [`KT-54650`](https://youtrack.jetbrains.com/issue/KT-54650) Binary incompatible ABI change in Kotlin 1.7.20 - [`KT-54802`](https://youtrack.jetbrains.com/issue/KT-54802) "VerifyError: Bad type on operand stack" for inline functions on arrays ##### Native. Runtime. Memory - [`KT-54498`](https://youtrack.jetbrains.com/issue/KT-54498) Deprecation message of 'FreezingIsDeprecated' is not really helpful ##### Tools. Gradle. Multiplatform - [`KT-54387`](https://youtrack.jetbrains.com/issue/KT-54387) Remove MPP alpha stability warning - [`KT-48436`](https://youtrack.jetbrains.com/issue/KT-48436) False positive "The Kotlin source set androidAndroidTestRelease was configured but not added to any Kotlin compilation" ##### Tools. JPS - [`KT-45474`](https://youtrack.jetbrains.com/issue/KT-45474) False positive NO_ELSE_IN_WHEN on sealed class with incremental compilation ### [`v1.7.20`](https://togithub.com/JetBrains/kotlin/blob/HEAD/ChangeLog.md#​1720) ##### Analysis API - [`KT-52667`](https://youtrack.jetbrains.com/issue/KT-52667) FIR IDE: fun interfaces (SAM interfaces) are not properly resolved - [`KT-52136`](https://youtrack.jetbrains.com/issue/KT-52136) FIR: Implicit type declaration from the other module cannot be used for overloading ##### Analysis API. FE1.0 - [`KT-51962`](https://youtrack.jetbrains.com/issue/KT-51962) Analysis API: Finish Analysis API for FE1.0 ##### Analysis API. FIR - [`KT-52779`](https://youtrack.jetbrains.com/issue/KT-52779) FIR IDE: Import Optimizer cannot handle generic type qualifiers - [`KT-50236`](https://youtrack.jetbrains.com/issue/KT-50236) Fix OOB modification trackers for non-Kotlin code - [`KT-51240`](https://youtrack.jetbrains.com/issue/KT-51240) Analysis API: KtAnalysisSession for a specific module cannot create a symbol for PSI that cannot be seen from that module. - [`KT-50868`](https://youtrack.jetbrains.com/issue/KT-50868) Analysis API: decompiled type aliases are not resolved ##### Compiler - [`KT-53739`](https://youtrack.jetbrains.com/issue/KT-53739) Builder inference, extension hides members - [`KT-53733`](https://youtrack.jetbrains.com/issue/KT-53733) Kotlin/Native: update source documentation for the new default memory manager - [`KT-53667`](https://youtrack.jetbrains.com/issue/KT-53667) Compiler crashes on attempt to alloc a string on the stack in new MM - [`KT-53480`](https://youtrack.jetbrains.com/issue/KT-53480) Internal error in file lowering: java.lang.ClassNotFoundException: com.android.systemui.R$string - [`KT-52843`](https://youtrack.jetbrains.com/issue/KT-52843) Compose: NPE at Parameters.getParameterByDeclarationSlot if inline function with default arguments takes a lambda which captures value class represented by Long - [`KT-53475`](https://youtrack.jetbrains.com/issue/KT-53475) Kotlin/Native for iOS: "IllegalArgumentException: Sequence has more than one element" ##### New Features - [`KT-52495`](https://youtrack.jetbrains.com/issue/KT-52495) Support until operator in back-ends - [`KT-52420`](https://youtrack.jetbrains.com/issue/KT-52420) Implement resolve of until operator - [`KT-52419`](https://youtrack.jetbrains.com/issue/KT-52419) Implement until operator in the parser - [`KT-33755`](https://youtrack.jetbrains.com/issue/KT-33755) Kotlin/Native: Provide a way to customize a bundle Identifier of a generated framework - [`KT-51665`](https://youtrack.jetbrains.com/issue/KT-51665) FIR: implement label resolve for "typed this" case - [`KT-52361`](https://youtrack.jetbrains.com/issue/KT-52361) Report warning on potentially empty intersection types ##### Performance Improvements - [`KT-47816`](https://youtrack.jetbrains.com/issue/KT-47816) Disable script discovery for non-script environments - [`KT-48635`](https://youtrack.jetbrains.com/issue/KT-48635) JVM IR: Double/Float values are boxed when comparing for equality in equals method of data/value classes - [`KT-23397`](https://youtrack.jetbrains.com/issue/KT-23397) Optimize out field for property delegate when it's safe (JVM) ##### Fixes - [`KT-53272`](https://youtrack.jetbrains.com/issue/KT-53272) Backend Internal error: Exception during IR lowering / No such value argument slot: 2 - [`KT-53124`](https://youtrack.jetbrains.com/issue/KT-53124) Receiver type mismatch when combining extension properties, type projections, Java sources, and F-bounded type-variables - [`KT-51868`](https://youtrack.jetbrains.com/issue/KT-51868) JVM / IR: Inconsistent behaviour between lambda expression and SAM interface conversion for the same interface - [`KT-36770`](https://youtrack.jetbrains.com/issue/KT-36770) Prohibit unsafe calls with expected `@NotNull` T and given Kotlin generic parameter with nullable bound - [`KT-52974`](https://youtrack.jetbrains.com/issue/KT-52974) "IllegalStateException: Symbol with IrSimpleFunctionSymbolImpl is unbound" compiling native targets of MPP project - [`KT-53007`](https://youtrack.jetbrains.com/issue/KT-53007) JVM: "Bad invokespecial instruction: current class isn't assignable to reference class" when call superclass of outer class method from inner class - [`KT-53019`](https://youtrack.jetbrains.com/issue/KT-53019) K2: cannot cast callable reference to Function1 in runtime - [`KT-53031`](https://youtrack.jetbrains.com/issue/KT-53031) K2 compiler crashes with IllegalStateException: No type in ProtoBuf.ValueParameter - [`KT-29168`](https://youtrack.jetbrains.com/issue/KT-29168) Prohibit upper bounds violation with generic typealias using not all type parameters as arguments for underlying type in supertypes - [`KT-52432`](https://youtrack.jetbrains.com/issue/KT-52432) Using the IDE compiled with K2 (useFir) throws VerifyError exception - [`KT-52327`](https://youtrack.jetbrains.com/issue/KT-52327) False negative: TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM isn't reported - [`KT-49682`](https://youtrack.jetbrains.com/issue/KT-49682) Support JVM IR in KAPT stub generation - [`KT-24643`](https://youtrack.jetbrains.com/issue/KT-24643) Prohibit using a type parameter declared for an extension property inside delegate - [`KT-51972`](https://youtrack.jetbrains.com/issue/KT-51972) FIR, Gradle: "Symbol is invisible" compilation error with enabled Kotlin Lombok compiler plugin - [`KT-52011`](https://youtrack.jetbrains.com/issue/KT-52011) \[FIR] All-open compiler plugin isn't supported - [`KT-51950`](https://youtrack.jetbrains.com/issue/KT-51950) JVM IR: "IndexOutOfBoundsException: Cannot pop operand off an empty stack" with crossinline lambdas and interface delegation - [`KT-52540`](https://youtrack.jetbrains.com/issue/KT-52540) Native: kotlin.NotImplementedError with Arrow library - [`KT-48031`](https://youtrack.jetbrains.com/issue/KT-48031) "IllegalStateException: Type variable TypeVariable(T) should not be fixed!" - [`KT-47708`](https://youtrack.jetbrains.com/issue/KT-47708) RequiresOptIn check does not flag experimental method usage in SAM lambda expressions - [`KT-52913`](https://youtrack.jetbrains.com/issue/KT-52913) JVM / IR: "IllegalArgumentException: Inline class types should have the same representation" when trying to down cast cast a value class - [`KT-50771`](https://youtrack.jetbrains.com/issue/KT-50771) IR partial linkage: Removed abstract callable members are not supported - [`KT-52994`](https://youtrack.jetbrains.com/issue/KT-52994) Enable generic inline classes as experimental feature - [`KT-52742`](https://youtrack.jetbrains.com/issue/KT-52742) CYCLE_IN_ANNOTATION_PARAMETER_ERROR false positive on annotations with default values - [`KT-52743`](https://youtrack.jetbrains.com/issue/KT-52743) Non-null generic functions throws NPE when assigned to val - [`KT-52745`](https://youtrack.jetbrains.com/issue/KT-52745) Frontend / K2: "IncompatibleClassChangeError: class A$B overrides final method A.length()I" caused by delegation in a sealed class - [`KT-52832`](https://youtrack.jetbrains.com/issue/KT-52832) Tree-generator's method FirExpression::isFirType returns true and false for different field names; it should always be true - [`KT-52403`](https://youtrack.jetbrains.com/issue/KT-52403) IncompatibleClassChangeError when inlining suspend funs - [`KT-50107`](https://youtrack.jetbrains.com/issue/KT-50107) Missed USAGE_IS_NOT_INLINABLE diagnostic: Leaking inline lambda parameter through extension receiver - [`KT-47965`](https://youtrack.jetbrains.com/issue/KT-47965) Missed USAGE_IS_NOT_INLINABLE diagnostic on inline lambda parameter usage as receiver of .let call - [`KT-25787`](https://youtrack.jetbrains.com/issue/KT-25787) No error on crossinline usage of receiver parameter of functional type in an inline function - [`KT-52762`](https://youtrack.jetbrains.com/issue/KT-52762) Frontend / K2: Named arguments for Java classes lead to "Cannot find a parameter with this name" - [`KT-52680`](https://youtrack.jetbrains.com/issue/KT-52680) K2: overload resolution ambiguity if `this` is casted in a different method - [`KT-52676`](https://youtrack.jetbrains.com/issue/KT-52676) K2: Unsupported compile-time value IrGetFieldImpl instead of IrConst in AnnotationCodegen for constant from Java - [`KT-50293`](https://youtrack.jetbrains.com/issue/KT-50293) False positive: USELESS_CAST on stub types - [`KT-52175`](https://youtrack.jetbrains.com/issue/KT-52175) WRONG_ANNOTATION_TARGET for annotation that used inside if - [`KT-52338`](https://youtrack.jetbrains.com/issue/KT-52338) "IncompatibleClassChangeError: Expected non-static field" with Kotlin class with same-named companion object property as base Java class field - [`KT-49507`](https://youtrack.jetbrains.com/issue/KT-49507) JVM: "IllegalAccessError: class X tried to access private field" with same-named Kotlin property and Java base class field - [`KT-44512`](https://youtrack.jetbrains.com/issue/KT-44512) FIR DFA: incorrect smartcast after null assignment inside a lambda - [`KT-49200`](https://youtrack.jetbrains.com/issue/KT-49200) FIR/FE 1.0: different behavior with multiple matching star imports - [`KT-52718`](https://youtrack.jetbrains.com/issue/KT-52718) declaringClass deprecation message mentions the wrong replacement in 1.7 - [`KT-52190`](https://youtrack.jetbrains.com/issue/KT-52190) FIR2IR: Unexpected IrErrorTypeImpl type for put method inside buildMap - [`KT-52197`](https://youtrack.jetbrains.com/issue/KT-52197) Incorrect inference of var type inside lambda that passed to extension function with type parameters that defined inside this lambda - [`KT-52057`](https://youtrack.jetbrains.com/issue/KT-52057) Unsupported compile-time value STRING_CONCATENATION and GET_FIELD in annotation arguments - [`KT-47823`](https://youtrack.jetbrains.com/issue/KT-47823) JVM IR: "IllegalArgumentException: Inline class types should have the same representation" with `break` usage in the loop range - [`KT-51883`](https://youtrack.jetbrains.com/issue/KT-51883) Kotlin 1.6.20 generates "-" in type names around lambdas and inline extension function with reified type which breaks Apache Beam - [`KT-52684`](https://youtrack.jetbrains.com/issue/KT-52684) Syntax error regression on complicated combination of LT and GTEQ - [`KT-52417`](https://youtrack.jetbrains.com/issue/KT-52417) Reflection: Can't reflect on type parameters captured by SAM converted lambda - [`KT-46797`](https://youtrack.jetbrains.com/issue/KT-46797) JVM IR: suspendImpl has no generic signature, breaking reified types in anonymous object supertypes when using the type token pattern - [`KT-51464`](https://youtrack.jetbrains.com/issue/KT-51464) FIR: Unable to infer type in coroutines flow code - [`KT-52163`](https://youtrack.jetbrains.com/issue/KT-52163) JVM IR: Double.compareTo(Int) compiled to integer comparison - [`KT-41980`](https://youtrack.jetbrains.com/issue/KT-41980) FIR: erroneous scope during annotation resolve - [`KT-47159`](https://youtrack.jetbrains.com/issue/KT-47159) `KtPsiUtils.areParenthesesUseless()` is returning a false positive on expressions for interface delegation - [`KT-51418`](https://youtrack.jetbrains.com/issue/KT-51418) Substitute anonymous type's supertypes - [`KT-35544`](https://youtrack.jetbrains.com/issue/KT-35544) kotlin.TypeCastException has no message on Native - [`KT-52386`](https://youtrack.jetbrains.com/issue/KT-52386) StackOverflowError during Kotlin/Native gradle build - [`KT-52592`](https://youtrack.jetbrains.com/issue/KT-52592) NPE from KProperty.getExtensionDelegate on property delegated to another property - [`KT-52551`](https://youtrack.jetbrains.com/issue/KT-52551) Delegating to object property reference does not invoke object's initializer - [`KT-51704`](https://youtrack.jetbrains.com/issue/KT-51704) Contracts: "AssertionError: Arguments and parameters size mismatch" with companion object - [`KT-25527`](https://youtrack.jetbrains.com/issue/KT-25527) False positive UNUSED_VALUE for delegated property/variable - [`KT-51002`](https://youtrack.jetbrains.com/issue/KT-51002) \[FIR] Hidden declaration hides visible one - [`KT-51008`](https://youtrack.jetbrains.com/issue/KT-51008) \[FIR] Star import does not work for nested calssifiers of java class - [`KT-52407`](https://youtrack.jetbrains.com/issue/KT-52407) FIR: Star import has lower priority than built-in import - [`KT-52431`](https://youtrack.jetbrains.com/issue/KT-52431) Reported error instead of warning due to empty intersection type found - [`KT-49394`](https://youtrack.jetbrains.com/issue/KT-49394) Bad message and suggestion: The feature "unit conversion" is disabled - [`KT-51168`](https://youtrack.jetbrains.com/issue/KT-51168) FIR: Inference error with Java interop and captured types - [`KT-49961`](https://youtrack.jetbrains.com/issue/KT-49961) "AssertionError: Left expression was not processed: BINARY_EXPRESSION" when analyzing dangling \[bracketed] expression inside elvis - [`KT-50108`](https://youtrack.jetbrains.com/issue/KT-50108) Difference in fun interface conversion behavior for uninitialized not-null function values - [`KT-51889`](https://youtrack.jetbrains.com/issue/KT-51889) Calls to super-classes constructors with context receivers fail on runtime - [`KT-51228`](https://youtrack.jetbrains.com/issue/KT-51228) \[FIR] Unresolved reference on callable reference on implicit `this` with smartcast - [`KT-52364`](https://youtrack.jetbrains.com/issue/KT-52364) False positive for INFERRED_TYPE_VARIABLE_INTO_EMPTY_INTERSECTION - [`KT-52237`](https://youtrack.jetbrains.com/issue/KT-52237) JVM / IR: "IllegalArgumentException: No argument for parameter VALUE_PARAMETER CONTINUATION_CLASS" when implementing Map interface on class with suspending functions - [`KT-50832`](https://youtrack.jetbrains.com/issue/KT-50832) Method references to suspend inline functions are processed incorrectly - [`KT-52194`](https://youtrack.jetbrains.com/issue/KT-52194) False positive "Class 'my.packge.MyClass' is compiled by a pre-release version of Kotlin and cannot be loaded by this version of the compiler" but builds fine - [`KT-47203`](https://youtrack.jetbrains.com/issue/KT-47203) JVM Debugger: Parameter value doesn't change for tailrec function - [`KT-52131`](https://youtrack.jetbrains.com/issue/KT-52131) False positive variable unused warning when calling inline function in finally block - [`KT-51738`](https://youtrack.jetbrains.com/issue/KT-51738) Debugger: stepping over in inline function with multiple inline lambda invocations is incorrect - [`KT-52198`](https://youtrack.jetbrains.com/issue/KT-52198) Losing reference to the value of an outer variable (Ref$ObjectRef) when using suspend inline with suspendCancellableCoroutine - [`KT-50994`](https://youtrack.jetbrains.com/issue/KT-50994) FIR: AssertionError during inference of delegated properties with implicit types - [`KT-51757`](https://youtrack.jetbrains.com/issue/KT-51757) FIR does not see various JS/Native specific declarations in common modules - [`KT-51201`](https://youtrack.jetbrains.com/issue/KT-51201) FIR: ARGUMENT_TYPE_MISMATCH diagnostic contains generic parameter instead of the actual type - [`KT-48444`](https://youtrack.jetbrains.com/issue/KT-48444) FIR: type argument rejected for annotation - [`KT-51754`](https://youtrack.jetbrains.com/issue/KT-51754) JVM: Local variable table invalid for do-while with continue - [`KT-51936`](https://youtrack.jetbrains.com/issue/KT-51936) Breakpoint not hit on last line of suspend function on Android - [`KT-27333`](https://youtrack.jetbrains.com/issue/KT-27333) Forbid `@Synchronized` annotation on suspend functions - [`KT-51530`](https://youtrack.jetbrains.com/issue/KT-51530) "StackOverflowError: CoroutineTransformerMethodVisitor.spillVariables" with data class in Flow - [`KT-51460`](https://youtrack.jetbrains.com/issue/KT-51460) FIR: Protected property inaccessible from inner class - [`KT-53947`](https://youtrack.jetbrains.com/issue/KT-53947) IllegalStateException: No mapping for symbol: VALUE_PARAMETER INSTANCE_RECEIVER - [`KT-51234`](https://youtrack.jetbrains.com/issue/KT-51234) Context receivers can be duplicated in function declaration - [`KT-51576`](https://youtrack.jetbrains.com/issue/KT-51576) Context receivers: "AssertionError: Callers must check that current token is IDENTIFIER followed with '@​'" with `at` character - [`KT-49479`](https://youtrack.jetbrains.com/issue/KT-49479) JVM / IR: "IllegalStateException: IrErrorType" during IR lowering with non-trivial recursion calls - [`KT-52270`](https://youtrack.jetbrains.com/issue/KT-52270) NullPointerException caused by braces on if-else returning a method reference inside lambda - [`KT-47621`](https://youtrack.jetbrains.com/issue/KT-47621) False negative INVISIBLE_MEMBER on call to inaccessible protected synthetic property setter - [`KT-37796`](https://youtrack.jetbrains.com/issue/KT-37796) NI: "ISE: Error type encountered" when inferring type of a property that delegates to itself - [`KT-45430`](https://youtrack.jetbrains.com/issue/KT-45430) PSI2IR: "org.jetbrains.kotlin.psi2ir.generators.ErrorExpressionException: null: KtCallExpression: toString()" with recursive function call in "also" block in nontrivial context - [`KT-52691`](https://youtrack.jetbrains.com/issue/KT-52691) K2: Expected FirResolvedTypeRef with ConeKotlinType but was FirImplicitTypeRefImpl with intertwined functional interfaces - [`KT-52822`](https://youtrack.jetbrains.com/issue/KT-52822) Fix contract for KtElement.getReference() - [`KT-50223`](https://youtrack.jetbrains.com/issue/KT-50223) IndexOutOfBoundsException from `ClassicTypeSystemContext$DefaultImpls.getParameter` during call resolution - [`KT-51963`](https://youtrack.jetbrains.com/issue/KT-51963) Change Maven version to 1.7.255 - [`KT-47664`](https://youtrack.jetbrains.com/issue/KT-47664) Incorrect type checking in the case of generic types - [`KT-48765`](https://youtrack.jetbrains.com/issue/KT-48765) NI: Inferred type does not respect the bound of type variable - [`KT-51243`](https://youtrack.jetbrains.com/issue/KT-51243) False positive error "No required context receiver" inside contextual lambda - [`KT-43541`](https://youtrack.jetbrains.com/issue/KT-43541) TYPE_MISMATCH for member function which is not occur for top level function during unsafe cast - [`KT-51016`](https://youtrack.jetbrains.com/issue/KT-51016) \[FIR] False positive OVERLOAD_RESOLUTION_AMBIGUITY between two extensions on different supertypes - [`KT-50155`](https://youtrack.jetbrains.com/issue/KT-50155) FIR: support contextual receivers - [`KT-38637`](https://youtrack.jetbrains.com/issue/KT-38637) Catch NoSuchFieldException in optimized when expression over enum ##### Docs & Examples - [`KT-49896`](https://youtrack.jetbrains.com/issue/KT-49896) Kotlin/JS: improve `-Xir-property-lazy-initialization` description due to making it true by default ##### IDE - [`KTIJ-22286`](https://youtrack.jetbrains.com/issue/KTIJ-22286) Kotlin JPS project created via wizard does not contain Kotlin libraries in case of not-released version - [`KTIJ-22065`](https://youtrack.jetbrains.com/issue/KTIJ-22065) IDE notification motivating Kotlin users to use EAP - [`KTIJ-22209`](https://youtrack.jetbrains.com/issue/KTIJ-22209) Configure Kotlin on 221 idea adds 1.6.10 Kotlin (despite the fact that IDE plugin is 1.7.10) - [`KTIJ-22171`](https://youtrack.jetbrains.com/issue/KTIJ-22171) Fix test BuiltInDecompilerConsistencyTest - [`KTIJ-22016`](https://youtrack.jetbrains.com/issue/KTIJ-22016) Empty .kt file and build.gradle.kts can trigger an error while searching for a facade light class - [`KT-52571`](https://youtrack.jetbrains.com/issue/KT-52571) MPP Tasks on import are not up-to-date after subsequent launches - [`KT-47777`](https://youtrack.jetbrains.com/issue/KT-47777) ISE thrown from KtLightClassForFacadeImpl.Companion.createForFacadeNoCache has wrong message. ##### IDE. FIR - [`KT-52360`](https://youtrack.jetbrains.com/issue/KT-52360) FIR IDE: Make the fix of `isInheritor` method better - [`KT-51786`](https://youtrack.jetbrains.com/issue/KT-51786) FIR IDE: IllegalStateException exception in Inspections' infrastructure - [`KT-52331`](https://youtrack.jetbrains.com/issue/KT-52331) Analysis API: ArrayIndexOutOfBoundsException exception in Diagnostics' infrastructure ##### IDE. Code Style, Formatting - [`KTIJ-21346`](https://youtrack.jetbrains.com/issue/KTIJ-21346) Incorrect formatting for functions with context receivers and visibility modifiers ##### IDE. Completion - [`KTIJ-21910`](https://youtrack.jetbrains.com/issue/KTIJ-21910) FIR IDE: Fix completion tests started failing after visibility checker refinement ##### IDE. Decompiler, Indexing, Stubs - [`KTIJ-21243`](https://youtrack.jetbrains.com/issue/KTIJ-21243) ContextReceivers: "UpToDateStubIndexMismatch: PSI and index do not match" plugin exception on library with context receivers usage attempt ##### IDE. Gradle Integration - [`KT-47627`](https://youtrack.jetbrains.com/issue/KT-47627) IDE import fails with com.intellij.util.lang.PathClassLoader error for `runCommonizer` Gradle task on 212, 213 IDEAs - [`KTIJ-21638`](https://youtrack.jetbrains.com/issue/KTIJ-21638) MPP: IntelliJ can not resolve MPP references in common-code - [`KT-52216`](https://youtrack.jetbrains.com/issue/KT-52216) HMPP / KTOR: False positive "TYPE_MISMATCH" with Throwable descendant ##### IDE. Inspections and Intentions - [`KTIJ-22540`](https://youtrack.jetbrains.com/issue/KTIJ-22540) Invalid "remove unnecessary parentheses" when delegating a functional interface to a SAM in brackets ##### IDE. J2K - [`KTIJ-21665`](https://youtrack.jetbrains.com/issue/KTIJ-21665) J2K generates non compiling code when lifting `return` and one branch is broken before binary operator ##### IDE. JS - [`KTIJ-22337`](https://youtrack.jetbrains.com/issue/KTIJ-22337) Wizard: Kotlin/Js for browser: cssSupport DSL should be updated ##### IDE. K2 - [`KTIJ-21672`](https://youtrack.jetbrains.com/issue/KTIJ-21672) FIR IDE: Method reference on generic class breaks resolve - [`KTIJ-21714`](https://youtrack.jetbrains.com/issue/KTIJ-21714) FIR IDE: Inherently imported type from another module is not properly resolved ##### IDE. Script - [`KT-52525`](https://youtrack.jetbrains.com/issue/KT-52525) Update scripts handling in source roots ##### IDE. Misc - [`KTIJ-21699`](https://youtrack.jetbrains.com/issue/KTIJ-21699) Refactoring: move out parts of the plugin useful for both FE10 and K2 ##### JavaScript ##### New Features - [`KT-39423`](https://youtrack.jetbrains.com/issue/KT-39423) KJS: Optionally generate a method to handle optional parameters for function in typescript - [`KT-42282`](https://youtrack.jetbrains.com/issue/KT-42282) KJS IR: add an ability to run separate tests ##### Performance Improvements - [`KT-50270`](https://youtrack.jetbrains.com/issue/KT-50270) KJS IR: Unnecessary getter and setter calls when accessing class members ##### Fixes - [`KT-51133`](https://youtrack.jetbrains.com/issue/KT-51133) Kotlin/JS - IR: even simple lambdas generate a lot of useless boilerplate - [`KT-51123`](https://youtrack.jetbrains.com/issue/KT-51123) Provide a way to add comments to generated JS - [`KT-48493`](https://youtrack.jetbrains.com/issue/KT-48493) KJS / IR: Invalid d.ts for inner classes inside objects - [`KT-52553`](https://youtrack.jetbrains.com/issue/KT-52553) KJS / IR: diamond hierarchy with super.toString produces stack overflow in runtime - [`KT-23252`](https://youtrack.jetbrains.com/issue/KT-23252) JS: Unit materialization on declaration and assignment - [`KT-51128`](https://youtrack.jetbrains.com/issue/KT-51128) Kotlin/JS - IR generate huge count of useless blocks - [`KT-50778`](https://youtrack.jetbrains.com/issue/KT-50778) KJS/IR: Inline class has no field when building production distribution - [`KT-50157`](https://youtrack.jetbrains.com/issue/KT-50157) KSJ IR: Applying identity equality operator to Chars always returns false - [`KT-38262`](https://youtrack.jetbrains.com/issue/KT-38262) Javascript generation (and Typescript) fails on 'then', 'catch' and 'finally' (and others?) claiming they are reserved names - [`KT-51066`](https://youtrack.jetbrains.com/issue/KT-51066) KJS / IR: suspend lambda parameter of value class is undefined - [`KT-51102`](https://youtrack.jetbrains.com/issue/KT-51102) KJS/IR: Assertion failed at translateCallArguments(jsAstUtils.kt:343) - [`KT-51878`](https://youtrack.jetbrains.com/issue/KT-51878) KJS / Legacy: Unit is not materialized in an overridden method, but it should be ##### Language Design - [`KT-47986`](https://youtrack.jetbrains.com/issue/KT-47986) Implicit inferring a type variable into an upper bound in the builder inference context - [`KT-49264`](https://youtrack.jetbrains.com/issue/KT-49264) Deprecate infix function calls of functions named "suspend" with dangling function literal - [`KT-25636`](https://youtrack.jetbrains.com/issue/KT-25636) Native: Object is frozen by default problem - [`KT-49303`](https://youtrack.jetbrains.com/issue/KT-49303) Implement support for basic compile-time evaluation ##### Libraries - [`KT-52932`](https://youtrack.jetbrains.com/issue/KT-52932) Open-ended ranges in the standard library - [`KT-52910`](https://youtrack.jetbrains.com/issue/KT-52910) Provide visit extension functions for java.nio.file.Path - [`KT-48232`](https://youtrack.jetbrains.com/issue/KT-48232) Multiplatform function for computing cubic root - [`KT-52778`](https://youtrack.jetbrains.com/issue/KT-52778) The documentation for the `Duration` does not indicate any differences from the ISO-8601 - [`KT-52618`](https://youtrack.jetbrains.com/issue/KT-52618) ThreadLocalRandom is not a good source of randomness on Android before SDK 34, so don't use it for Kotlin Random ##### Native - [`KT-53346`](https://youtrack.jetbrains.com/issue/KT-53346) MPP project with kotlinx-serialization-json:1.4.0-RC is not built ##### Native. C Export - [`KT-45468`](https://youtrack.jetbrains.com/issue/KT-45468) Kotlin/Native: Bitcode verification error when trying to export a cached klib to a static or dynamic library ##### Native. C and ObjC Import - [`KT-53373`](https://youtrack.jetbrains.com/issue/KT-53373) Native: [@​ExportObjCClass](https://togithub.com/ExportObjCClass) doesn't work with the new memory manager - [`KT-49034`](https://youtrack.jetbrains.com/issue/KT-49034) Kotlin/Native: `cnames.structs.Foo` resolves into wrong declaration - [`KT-26478`](https://youtrack.jetbrains.com/issue/KT-26478) Objective-C object's class name is null in ClassCastException's message ##### Native. ObjC Export - [`KT-51593`](https://youtrack.jetbrains.com/issue/KT-51593) Include more information in Objective-C header documentation - [`KT-33117`](https://youtrack.jetbrains.com/issue/KT-33117) Improve customizing Info.plist in produced frameworks - [`KT-52681`](https://youtrack.jetbrains.com/issue/KT-52681) Native: `@end;` for Objective-C is generated with an unnecessary semicolon ##### Native. Platforms - [`KT-52226`](https://youtrack.jetbrains.com/issue/KT-52226) Kotlin/Native: Add support for cross-compilation of MIPS targets from macOS and Windows hosts ##### Native. Runtime - [`KT-52430`](https://youtrack.jetbrains.com/issue/KT-52430) KMM 1.6.21 framework built with Xcode13, new MM GC Can't support iOS 9.x - [`KT-53534`](https://youtrack.jetbrains.com/issue/KT-53534) Kotlin/Native: `-Xruntime-logs=gc=info` flag doesn't work with compiler caches in 1.7.20-beta ##### Native. Runtime. Memory - [`KT-52692`](https://youtrack.jetbrains.com/issue/KT-52692) Kotlin/Native: fix tests with aggressive GC - [`KT-52130`](https://youtrack.jetbrains.com/issue/KT-52130) Kotlin/Native: use Xallocator for Kotlin objects only - [`KT-51436`](https://youtrack.jetbrains.com/issue/KT-51436) Kotlin/Native: optimize mark queue ##### Reflection - [`KT-51804`](https://youtrack.jetbrains.com/issue/KT-51804) An error occurs when callBy a KFunction that contains a value class as an argument, has a default argument set, and has more than 32 arguments. ##### Tools. CLI - [`KT-52465`](https://youtrack.jetbrains.com/issue/KT-52465) CLI: IllegalStateException IrSimpleFunctionPublicSymbolImpl when source root is duplicated - [`KT-52380`](https://youtrack.jetbrains.com/issue/KT-52380) Invalid path to compiler plugins should be reported as a compiler error - [`KT-51025`](https://youtrack.jetbrains.com/issue/KT-51025) JVM CLI compiler takes class file from classpath instead of input java source file - [`KT-51846`](https://youtrack.jetbrains.com/issue/KT-51846) Setting random value to the compiler argument where number is expected should produce an error. "-Xbackend-threads=abcd" ##### Tools. Compiler Plugins - [`KT-52486`](https://youtrack.jetbrains.com/issue/KT-52486) \[K2] Looking for function/constructor whose parameters are annotated or meta annotated - [`KT-52872`](https://youtrack.jetbrains.com/issue/KT-52872) Mark supportsK2 in ComponentRegistrar.kt as JvmDefault to avoid compatibility problems - [`KT-52804`](https://youtrack.jetbrains.com/issue/KT-52804) A function obtained by Fir IrBuiltins has an incorrect package - [`KT-52468`](https://youtrack.jetbrains.com/issue/KT-52468) Rename module and jar for lombok compiler plugin ##### Tools. Gradle - [`KT-53670`](https://youtrack.jetbrains.com/issue/KT-53670) Gradle: Cyclic dependency between kotlin-gradle-plugin-idea-1.7.20-Beta and kotlin-gradle-plugin-idea-proto-1.7.20-Beta - [`KT-53615`](https://youtrack.jetbrains.com/issue/KT-53615) Gradle: Fix deprecation warnings in CleanableStoreImpl - [`KT-53118`](https://youtrack.jetbrains.com/issue/KT-53118) Fully up-to-date builds are slower with Kotlin 1.7.0 - [`KT-51923`](https://youtrack.jetbrains.com/issue/KT-51923) Improve usability of errors and warnings by being able to click on them - [`KT-53244`](https://youtrack.jetbrains.com/issue/KT-53244) Report from gradle about compiler plugins - [`KT-52839`](https://youtrack.jetbrains.com/issue/KT-52839) Warn in Gradle log why incremental compilation failed - [`KT-46019`](https://youtrack.jetbrains.com/issue/KT-46019) Compatibility with Gradle 7.1 release - [`KT-47047`](https://youtrack.jetbrains.com/issue/KT-47047) Migrate Kotlin Gradle Plugin from using Gradle conventions - [`KT-52698`](https://youtrack.jetbrains.com/issue/KT-52698) Don't add InspectClassesForMultiModuleIC task when new incremental compilation is enabled - [`KT-52867`](https://youtrack.jetbrains.com/issue/KT-52867) Provide simplified JVM toolchain configuration method - [`KT-45747`](https://youtrack.jetbrains.com/issue/KT-45747) Add basic JUnit 5 Kotlin Gradle Plugin Android tests setup - [`KT-46034`](https://youtrack.jetbrains.com/issue/KT-46034) Shadow Kotlin Gradle plugin dependencies - [`KT-28664`](https://youtrack.jetbrains.com/issue/KT-28664) Support ExtensionContainer on kotlin targets and source sets. - [`KT-19472`](https://youtrack.jetbrains.com/issue/KT-19472) Useful extensions of Gradle Kotlin DSL provided by Gradle Kotlin plugin - [`KT-34393`](https://youtrack.jetbrains.com/issue/KT-34393) Kotlin Gradle DSL: Inconsistent srcDir configuration between Java and Kotlin - [`KT-51629`](https://youtrack.jetbrains.com/issue/KT-51629) There isn't enough info about incremental compilation state in logs while running build with --info key ##### Tools. Gradle. Cocoapods - [`KT-53174`](https://youtrack.jetbrains.com/issue/KT-53174) CocoaPods: Synthetic Podfile does not specify platform - [`KT-53127`](https://youtrack.jetbrains.com/issue/KT-53127) "MaterialComponents normal armv7" in Cocoapods plugin between Kotlin 1.6.21 and 1.7.0 - [`KT-44155`](https://youtrack.jetbrains.com/issue/KT-44155) Cocoapods doesn't support pods without module map file inside - [`KT-49032`](https://youtrack.jetbrains.com/issue/KT-49032) Cocoapods cinterop: some header files are not found - [`KT-53337`](https://youtrack.jetbrains.com/issue/KT-53337) Add warning about future changing default linking type of framework provided via cocoapods plugin ##### Tools. Gradle. JS - [`KT-52637`](https://youtrack.jetbrains.com/issue/KT-52637) KJS / Gradle: Add SCSS webpack config - [`KT-51527`](https://youtrack.jetbrains.com/issue/KT-51527) Kotlin/JS: BrowserXRun causes full-screen Webpack error "Compiled with problems: asset size limit/entrypoint size limit" for fresh Kotlin-React project from wizard - [`KT-51532`](https://youtrack.jetbrains.com/issue/KT-51532) Kotlin/JS: passing environment variable via Gradle script causes "Execution optimizations have been disabled" warnings - [`KT-52221`](https://youtrack.jetbrains.com/issue/KT-52221) Kotlin/JS: failed Node tests are not reported in a standard way ##### Tools. Gradle. Multiplatform - [`KT-52243`](https://youtrack.jetbrains.com/issue/KT-52243) CInteropProcess is not cacheable despite the annotation - [`KT-52741`](https://youtrack.jetbrains.com/issue/KT-52741) MPP: klib outputs are not reproducible - [`KT-52208`](https://youtrack.jetbrains.com/issue/KT-52208) MPP: Gradle plugin 1.7 doesn't support latest api versions (1.8, 1.9) - [`KT-54071`](https://youtrack.jetbrains.com/issue/KT-54071) MPP/AGP compatibility: Bump maxSupportedVersion to 7.3.0 ##### Tools. Gradle. Native - [`KT-52632`](https://youtrack.jetbrains.com/issue/KT-52632) Gradle / Native: commonizeNativeDistributionTask can never be up-to-date - [`KT-52328`](https://youtrack.jetbrains.com/issue/KT-52328) "ld: framework not found SQLCipher" linkDebugTestIosSimulatorArm64 error ##### Tools. Incremental Compile - [`KT-53168`](https://youtrack.jetbrains.com/issue/KT-53168) Incremental compilation doesn't perform correctly after a few iterations - [`KT-52925`](https://youtrack.jetbrains.com/issue/KT-52925) \[IR BE] Non incremental build occurs after build failure for compileKotlinJs task - [`KT-52946`](https://youtrack.jetbrains.com/issue/KT-52946) CompileKotlinJs task is executed non-incrementally if there were changes made to the dependant module - [`KT-52329`](https://youtrack.jetbrains.com/issue/KT-52329) Reduce memory usage of classpath snapshot cache - [`KT-53266`](https://youtrack.jetbrains.com/issue/KT-53266) Increment Compilation: "IllegalStateException: The following LookupSymbols are not yet converted to ProgramSymbols" when changing companion object constant field - [`KT-53231`](https://youtrack.jetbrains.com/issue/KT-53231) New IC reports build failures for missing classpath snapshots ##### Tools. JPS - [`KT-47824`](https://youtrack.jetbrains.com/issue/KT-47824) 'when expression must be exhaustive' isn't thrown during incremental compilation - [`KT-51873`](https://youtrack.jetbrains.com/issue/KT-51873) JPS build is incorrect after gdw build - [`KTIJ-17072`](https://youtrack.jetbrains.com/issue/KTIJ-17072) JPS does not rebuild Kotlin usages of declared in Java when enum entry is added </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 👻 **Immortal**: This PR will be recreated if closed unmerged. Get [config help](https://togithub.com/renovatebot/renovate/discussions) if that's undesired. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/Wirlie/Enhanced-Glist). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNC4zNy4wIiwidXBkYXRlZEluVmVyIjoiMzQuMzcuMCJ9--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [com.google.code.gson:gson-parent](https://togithub.com/google/gson) | `2.9.0` -> `2.10.1` | [![age](https://badges.renovateapi.com/packages/maven/com.google.code.gson:gson-parent/2.10.1/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/maven/com.google.code.gson:gson-parent/2.10.1/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/maven/com.google.code.gson:gson-parent/2.10.1/compatibility-slim/2.9.0)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/maven/com.google.code.gson:gson-parent/2.10.1/confidence-slim/2.9.0)](https://docs.renovatebot.com/merge-confidence/) | | [com.google.code.gson:gson](https://togithub.com/google/gson) | `2.9.0` -> `2.10.1` | [![age](https://badges.renovateapi.com/packages/maven/com.google.code.gson:gson/2.10.1/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/maven/com.google.code.gson:gson/2.10.1/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/maven/com.google.code.gson:gson/2.10.1/compatibility-slim/2.9.0)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/maven/com.google.code.gson:gson/2.10.1/confidence-slim/2.9.0)](https://docs.renovatebot.com/merge-confidence/) | --- ### ⚠ Dependency Lookup Warnings ⚠ Warnings were logged while processing this repo. Please check the Dependency Dashboard for more information. --- ### Release Notes <details> <summary>google/gson</summary> ### [`v2.10`](https://togithub.com/google/gson/blob/HEAD/CHANGELOG.md#Version-210) - Support for serializing and deserializing Java records, on Java ≥ 16. ([https://github.com/google/gson/pull/2201](https://togithub.com/google/gson/pull/2201)) - Add `JsonArray.asList` and `JsonObject.asMap` view methods ([https://github.com/google/gson/pull/2225](https://togithub.com/google/gson/pull/2225)) - Fix `TypeAdapterRuntimeTypeWrapper` not detecting reflective `TreeTypeAdapter` and `FutureTypeAdapter` ([https://github.com/google/gson/pull/1787](https://togithub.com/google/gson/pull/1787)) - Improve `JsonReader.skipValue()` ([https://github.com/google/gson/pull/2062](https://togithub.com/google/gson/pull/2062)) - Perform numeric conversion for primitive numeric type adapters ([https://github.com/google/gson/pull/2158](https://togithub.com/google/gson/pull/2158)) - Add `Gson.fromJson(..., TypeToken)` overloads ([https://github.com/google/gson/pull/1700](https://togithub.com/google/gson/pull/1700)) - Fix changes to `GsonBuilder` affecting existing `Gson` instances ([https://github.com/google/gson/pull/1815](https://togithub.com/google/gson/pull/1815)) - Make `JsonElement` conversion methods more consistent and fix javadoc ([https://github.com/google/gson/pull/2178](https://togithub.com/google/gson/pull/2178)) - Throw `UnsupportedOperationException` when `JsonWriter.jsonValue` is not supported ([https://github.com/google/gson/pull/1651](https://togithub.com/google/gson/pull/1651)) - Disallow `JsonObject` `Entry.setValue(null)` ([https://github.com/google/gson/pull/2167](https://togithub.com/google/gson/pull/2167)) - Fix `TypeAdapter.toJson` throwing AssertionError for custom IOException ([https://github.com/google/gson/pull/2172](https://togithub.com/google/gson/pull/2172)) - Convert null to JsonNull for `JsonArray.set` ([https://github.com/google/gson/pull/2170](https://togithub.com/google/gson/pull/2170)) - Fixed nullSafe usage. ([https://github.com/google/gson/pull/1555](https://togithub.com/google/gson/pull/1555)) - Validate `TypeToken.getParameterized` arguments ([https://github.com/google/gson/pull/2166](https://togithub.com/google/gson/pull/2166)) - Fix [#​1702](https://togithub.com/google/gson/issues/1702): Gson.toJson creates CharSequence which does not implement toString ([https://github.com/google/gson/pull/1703](https://togithub.com/google/gson/pull/1703)) - Prefer existing adapter for concurrent `Gson.getAdapter` calls ([https://github.com/google/gson/pull/2153](https://togithub.com/google/gson/pull/2153)) - Improve `ArrayTypeAdapter` for `Object[]` ([https://github.com/google/gson/pull/1716](https://togithub.com/google/gson/pull/1716)) - Improve `AppendableWriter` performance ([https://github.com/google/gson/pull/1706](https://togithub.com/google/gson/pull/1706)) ### [`v2.9.1`](https://togithub.com/google/gson/blob/HEAD/CHANGELOG.md#Version-291) - Make `Object` and `JsonElement` deserialization iterative rather than recursi[https://github.com/google/gson/pull/1912](https://togithub.com/google/gson/pull/1912)1912) - Added parsing support for enum that has overridden toString() method ([https://github.com/google/gson/pull/1950](https://togithub.com/google/gson/pull/1950)) - Removed support for building Gson with Gradle ([https://github.com/google/gson/pull/2081](https://togithub.com/google/gson/pull/2081)) - Removed obsolete `codegen` hierarchy ([https://github.com/google/gson/pull/2099](https://togithub.com/google/gson/pull/2099)) - Add support for reflection access filter ([https://github.com/google/gson/pull/1905](https://togithub.com/google/gson/pull/1905)) - Improve `TypeToken` creation validation ([https://github.com/google/gson/pull/2072](https://togithub.com/google/gson/pull/2072)) - Add explicit support for `float` in `JsonWriter` ([https://github.com/google/gson/pull/2130](https://togithub.com/google/gson/pull/2130), [https://github.com/google/gson/pull/2132](https://togithub.com/google/gson/pull/2132)) - Fail when parsing invalid local date ([https://github.com/google/gson/pull/2134](https://togithub.com/google/gson/pull/2134)) Also many small improvements to javadoc. </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about these updates again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/elide-dev/v3). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNC4xMDIuMCIsInVwZGF0ZWRJblZlciI6IjM0LjEwMi4wIn0=-->
Previously only
Gson.fromJson(..., Type)
existed which is however not type-safe since the generic type parameterT
used for the return type is not bound.Example:
Since these methods are often used in the form
this commit now adds overloads which accept a
TypeToken
and are thereforemore type-safe:
With Java >= 9 another advantage is that you can use the 'diamond syntax' for anonymous classes (see JDK-8062373). If Gson had
fromJson
overloads withTypeToken
this would allow quite concise usage:Additional changes:
AddsfromJson(JsonReader, Class<T>)
for symmetry with other methodsEdit: Removed again because it breaks source compatibility, see comment
@see
tags; they currently have this order:fromJson
methods other thanfromJson(JsonReader, ...)
fully consume JSON (see JsonReader not strict about JSON document consumption #835)@SuppressWarnings("unchecked")
It appears
TypeToken
overloads were considered in the past but were then rejected, see #248 (comment). However, I have not found the discussion explaining why they were rejected.Open questions:
fromJson
methods taking aType
(but keeping them indefinitely). While this might be disruptive for users initially, switching to theTypeToken
variant will make their code safer. If they have, for whatever reason, only aType
available but noTypeToken
, then they can construct one withTypeToken.get(Type)
, but it is their task then to verify that the casts are safe.