weaviate / weaviate/java-client

v6: Disable Gson's ReflectionTypeAdapter

Open
#430 0 comments 0 reactions 1 assignee View on GitHub

@bevzzz is already working on this.

Since Jul 28, 2025.

v6
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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.