google / gson

A Java serialization/deserialization library to convert Java Objects into JSON and back
Apache License 2.0
23.29k stars 4.28k forks source link

Yes can confirm this; it looks like this was indeed introduced by 3e3266cf48f132928225e1561a6ae4cb5503d08f (by accident): #2707

Closed Brandylee24 closed 3 months ago

Brandylee24 commented 3 months ago
          Yes can confirm this; it looks like this was indeed introduced by 3e3266cf48f132928225e1561a6ae4cb5503d08f (by accident):

There is only JsonWriter.value(long), so the adapters for all other integral primitive types (byte, short, int) actually call value(long).

Sorry for that. Maybe it would make sense to (partially) revert that commit.

It seems AtomicInteger is affected as well, but it's adapter always behaved this way, that a Long instead of the AtomicInteger is stored in the JsonPrimitive. However, this might be a good thing since it is mutable and might cause confusing behavior if it was stored in JsonPrimitive.

Originally posted by @Marcono1234 in https://github.com/google/gson/issues/2680#issuecomment-2125875766

eamonnmcmanus commented 3 months ago

I don't know what this means.