HADOOP-19832 Fix missing relocation for org.jspecify in hadoop-shaded-guava#50
Conversation
org.jspecify:jspecify was added as a shaded artifact in 1.5.0 but without a corresponding relocation rule, causing its classes to be bundled at their original org/jspecify/annotations/ path. This produces classpath collisions in projects that also depend on the standalone org.jspecify:jspecify jar.
aajisaka
left a comment
There was a problem hiding this comment.
+1 for your patch. Would you open a https://issues.apache.org/jira/projects/HADOOP JIRA ticket for this?
|
@aajisaka I've requested a Jira account. Will create the ticket there as soon as I get an access. |
|
jspecify won't be used at runtime. can we exclude it? |
From Guava's own documentation:
Source: https://github.com/google/guava/wiki/UseGuavaInYourBuild#what-about-guavas-own-dependencies I think it's safer to keep it. |
I think we don't have such use cases in the Hadoop codebase, but I'm fine to keep it until we decide to move the baseline to JDK 17 for this repo. |
|
+1 for keep and shade, in case guava uses. |
|
Thanks. Added the claude mention for credit as I'd like to be able to track where it is being used...the copyright of ai generated code is really going to complicate all open source projects. Glad it helped though. |
Closes https://issues.apache.org/jira/browse/HADOOP-19832
Problem
org.jspecify:jspecifywas added as a shaded artifact in 1.5.0 but without a corresponding relocation rule. As a result, its classes are bundled at their originalorg/jspecify/annotations/path inside thehadoop-shaded-guavajar.This causes classpath collisions in projects that also have a direct or transitive dependency on
org.jspecify:jspecify, since the same class files appear from two different jars.Fix
Add a
<relocation>rule fororg/jspecify/in themaven-shade-pluginconfiguration, consistent with howcom/google/andorg/checkerframework/are already handled.For code changes:
Use of AI
Yes — Claude (Anthropic) was used to help identify the root cause and draft this fix.