Skip to content

Issue/2563 #2571

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

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Prev Previous commit
Next Next commit
remove extra comment
  • Loading branch information
msevcenko authored Dec 8, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit 3cad07c3b8dae35c472aba6133e561f01654a0f3
Original file line number Diff line number Diff line change
@@ -54,12 +54,6 @@ private static TypeAdapterFactory newFactory(final ToNumberStrategy toNumberStra
@SuppressWarnings("unchecked")
@Override
public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) {
// ObjectTypeAdapter now handles also raw enums. This is fine for serialization, as
// TypeAdapterRuntimeTypeWrapper would be used.
// Prior #2563, ObjectTypeAdapter was sometimes used implicitly by the rule
// that bound of type variable was ignored and interpreted as Object type;
// by rectifying this rule, we need to explicitly define that ObjectTypeAdapter handles
// raw enums.
if (type.getRawType() == Object.class) {
return (TypeAdapter<T>) new ObjectTypeAdapter(gson, toNumberStrategy);
}