gkopff / gson-javatime-serialisers

A set of GSON serialiser/deserialisers for dealing with Java 8 java.time entities.
MIT License
87 stars 19 forks source link

InstantTypeAdaptor fails on seconds #32

Open Phalguna2125 opened 1 year ago

Phalguna2125 commented 1 year ago

Hi ,

If json has time field represented as number of Seconds InstantConverter failed to deserialize it.

I have a test case where i use gson parse along with awaitility with seconds Published kafka record has gson.tojson mapping 20230728_125833

Throwing following exception::

Failed making field "java.time.Instant.seconds' accessible; either change its visibility or write a custom TypeAdapter for its declaring typel þal.reflect .ReflectionHelper.makeAccessible (ReflectionHelper.java:22) mal.bind. ReflectiveTypeAdapterFactory.getBoundField Caused by: java.lang.reflect.Inaccessible@bjectException: Unable to make field private final long java.time.Instant.seconds accessible: module

I tried following way of registering adaptor but still no success

Any suggestions could you kindly provide.. thanks in advance

Screenshot_20230728_113453_Gallery