fix: shade third-party deps in codeflash-runtime JAR#1911
Merged
HeshamHM28 merged 3 commits intomainfrom Mar 31, 2026
Merged
Conversation
…lasspath conflicts Relocate Gson, Kryo, Objenesis, SLF4J, JaCoCo, and ASM under com.codeflash.shaded.* in both Maven (shade plugin) and Gradle (shadow plugin). SQLite is left unshaded due to native lib loading. Also adds jarHell/thirdPartyAudit to the Gradle skip-validation init script as a defensive measure, and adds Gradle wrapper + syncs JaCoCo deps to the Gradle build. Fixes OpenSearch jar-hell failures caused by duplicate com.google.gson classes between the fat JAR and project dependencies. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Contributor
|
Claude finished @HeshamHM28's task in 1m 31s —— View job PR Review Summary
Prek ChecksAll ruff and format checks passed. No issues. Code ReviewBug: Gradle and Maven relocation rules are out of sync The latest commit ("fix: shade args4j and EMMA transitive deps") added Current state:
Any project using a Gradle-built JAR will still have relocate("org.kohsuke", "com.codeflash.shaded.org.kohsuke")
relocate("com.vladium", "com.codeflash.shaded.com.vladium")Duplicate DetectionNo duplicates detected. Last updated: 2026-03-31 |
Contributor
|
Two JaCoCo CLI transitive deps are still unshaded in the fat JAR:
Low collision risk, but for completeness: <relocation>
<pattern>org.kohsuke</pattern>
<shadedPattern>com.codeflash.shaded.org.kohsuke</shadedPattern>
</relocation>
<relocation>
<pattern>com.vladium</pattern>
<shadedPattern>com.codeflash.shaded.com.vladium</shadedPattern>
</relocation> |
Add relocation rules for org.kohsuke (args4j) and com.vladium (EMMA RT) to prevent classpath conflicts from unshaded JaCoCo CLI transitive deps. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
mashraf-222
approved these changes
Mar 31, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The
codeflash-runtime-1.0.0.jaris a fat JAR that bundles 2,000+ classes from Gson, Kryo, SLF4J, JaCoCo, etc. — all unshaded (no package relocation). When codeflash adds this JAR to a project's test classpath, it causes duplicate-class conflicts with the project's own dependencies.Real-world impact: On OpenSearch, the bundled
com.google.gson.*classes collide with Hadoop's Gson dependency, triggering OpenSearch'sjarHellprecommit check. This caused 602 build failures and 148 functions skipped.Fix
Relocate all third-party packages under
com.codeflash.shaded.*in both build systems:com.google.gsoncom.codeflash.shaded.com.google.gsoncom.esotericsoftware(Kryo)com.codeflash.shaded.com.esotericsoftwareorg.objenesiscom.codeflash.shaded.org.objenesisorg.slf4jcom.codeflash.shaded.org.slf4jorg.jacococom.codeflash.shaded.org.jacocoorg.objectweb.asmcom.codeflash.shaded.org.objectweb.asmSQLite is left unshaded (native library loading depends on exact resource paths).
Also includes:
jarHellandthirdPartyAuditto Gradle skip-validation init script as a safety netcodeflash-java-runtimeVerification
jar tfconfirms zero unshaded third-party classes remain (except SQLite)com.codeflash.*public API is unchanged — shading is fully internal🤖 Generated with Claude Code