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

RuntimeTypeAdapterFactory depends on internal API (JPMS, Java 9+) #1931

Closed
miasma opened this issue Aug 6, 2021 · 1 comment · Fixed by #1959
Closed

RuntimeTypeAdapterFactory depends on internal API (JPMS, Java 9+) #1931

miasma opened this issue Aug 6, 2021 · 1 comment · Fixed by #1959

Comments

@miasma
Copy link

miasma commented Aug 6, 2021

The RuntimeTypeAdapterFactory code example (https://github.com/google/gson/blob/master/extras/src/main/java/com/google/gson/typeadapters/RuntimeTypeAdapterFactory.java) depends on the internal API class com.google.gson.internal.Streams, which is not exported when depending on gson in a JPMS project using module path.

Unless there's some easy fix available, currently one has to make a copy of Streams, LazilyParsedNumber, and TypeAdapters classes from the internal packages in order to use this provided class.

@Marcono1234
Copy link
Collaborator

one has to make a copy of Streams, LazilyParsedNumber, and TypeAdapters classes

The classes LazilyParsedNumber and TypeAdapters would only be needed if you wanted to copy the exact code of TypeAdapters.JSON_ELEMENT, right? They don't appear to be needed directly by RuntimeTypeAdapterFactory.

I have tried implementing a fix in #1959, please let me know if that works for you.


Note that I am not a maintainer of this project.

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

Successfully merging a pull request may close this issue.

2 participants