Skip to content

docs: correct JavaBin native-image claim - #290

Merged
epugh merged 1 commit into
apache:mainfrom
adityamparikh:docs/javabin-native-comment
Nov 24, 2026
Merged

epugh merged 1 commit into
apache:mainfrom
adityamparikh:docs/javabin-native-comment

Conversation

@adityamparikh

Copy link
Copy Markdown
Contributor

Summary

Four places give a reason for the client's wire format that isn't true: that SolrJ's JavaBin codec "uses deep reflection" and would need extensive native-image hints.

 SolrConfig.buildSolrClient          // inline comment
 SolrNativeHints                     // class Javadoc
 AGENTS.md                           // "Wire format" bullet
 dev-docs/graalvm-native-image.md    // "Wire format choice underpins the small hint surface"
-  JavaBin needs reflection, so we avoid it
+  JSON responses + XMLRequestWriter; the native image doesn't require either

SolrNativeHints also called JsonResponseParser a SolrJ class (it is this project's) and said the XML path is avoided, though every update goes through XMLRequestWriter.

No code changes; only comments and docs.

Evidence

  • JavaBinCodec.java at releases/solr/10.0.0 has no java.lang.reflect, getDeclared*, getMethod, Class.forName or newInstance. Its one java.lang.invoke use is MethodHandles.lookup() for the logger. It dispatches on instanceof and tag bytes, which native-image analysis follows without hints.
  • With JavaBinResponseParser swapped in for JsonResponseParser and no hint added, ./gradlew nativeTest -Pnative passed (0 failed).
  • ./gradlew build: 460 tests, 0 failures, 0 skipped.

Merge Danger

Door: two-way

Blast Radius: docs

🤖 Generated with Claude Code

SolrConfig, SolrNativeHints, AGENTS.md and the native-image dev doc said
SolrJ's JavaBin codec uses deep reflection and needs extensive native-image
hints, and gave that as the reason for XMLRequestWriter and the JSON parser.
JavaBinCodec uses no reflection, and JavaBinResponseParser passes
nativeTest -Pnative without an added hint. Describe the wire format without
the false rationale. SolrNativeHints also called JsonResponseParser a SolrJ
class and said the XML path is avoided, though updates use XMLRequestWriter.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Aditya Parikh <aditya.m.parikh@gmail.com>
@sonarqubecloud

Copy link
Copy Markdown

@epugh
epugh merged commit 00a1ff2 into apache:main Nov 24, 2026
6 checks passed
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 this pull request may close these issues.

2 participants