Skip to content
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

Gson Reflection in Java 17 Compatibility #958

Open
ranicza opened this issue Feb 2, 2024 · 0 comments
Open

Gson Reflection in Java 17 Compatibility #958

ranicza opened this issue Feb 2, 2024 · 0 comments

Comments

@ranicza
Copy link

ranicza commented Feb 2, 2024

Hi guys, I encountered a compatibility issue when recently migrating to Java 17. There is an exception related to the use of the Gson library when it tries to parse exception

com.google.gson.JsonIOException: Failed making field 'java.lang.Throwable#detailMessage' accessible; either change its visibility or write a custom TypeAdapter for its declaring type at com.google.gson.internal.reflect.ReflectionHelper.makeAccessible(ReflectionHelper.java:23) ~[gson-2.9.1.jar:na] at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getBoundFields(ReflectiveTypeAdapterFactory.java:203) ~[gson-2.9.1.jar:na] at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.create(ReflectiveTypeAdapterFactory.java:112) ~[gson-2.9.1.jar:na] at com.google.gson.Gson.getAdapter(Gson.java:531) ~[gson-2.9.1.jar:na] at com.google.gson.Gson.fromJson(Gson.java:1057) ~[gson-2.9.1.jar:na] at com.google.gson.Gson.fromJson(Gson.java:1129) ~[gson-2.9.1.jar:na] at com.google.gson.Gson.fromJson(Gson.java:1101) ~[gson-2.9.1.jar:na] at com.kaltura.client.utils.GsonParser.parseException(GsonParser.java:283) ~[kalturaApiClient-19.3.0.jar:na]

As java 17's strengthened encapsulation model that restricts reflective access to internal APIs, impacting Gson's ability to serialize and deserialize exception details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant