weaviate / weaviate/java-client
v6: Disable Gson's ReflectionTypeAdapter
@bevzzz is already working on this.
Since Jul 28, 2025.
- Dominant language
- Java
- Stars
- 34
- Forks
- 30
- PR merge metrics
- No merged PRs in 30d
Description
JDK 17 made all internal classes strongly encapsulated, meaning reflection cannot be used on them.
We use this workaround --add-opens=java.base/java.lang=ALL-UNNAMED to allow Gson reflective access to all these classes, because we probably don't want to write custom TypeAdapters for each one. Since this isn't something we can "bake into" the JAR itself, we recommend users add that to their command line.
However, the encapsulation introduced in JDK 17 is a security feature and we should see if we can avoid using restrictive access. There's been many discussions about that in the Gson's repo and the consensus seems to be that using reflective de-/serialization is undesirable.
Relevant links:
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.