refactor(deps): remove dot.guava repackaged dependency#35315
Conversation
mbiuki
left a comment
There was a problem hiding this comment.
Clean, well-scoped PR. A few notes:
Two API fixes are correct:
Objects.toStringHelper()→MoreObjects.toStringHelper()— import correctly switched, removed in Guava 20.Cache.get(key)→Cache.getIfPresent(key)— right call;Cache.get(key)required aCallableloader in Guava 22+,getIfPresentis the correct no-loader equivalent.
dot.guava removed from both bom/application/pom.xml and dotCMS/pom.xml — clean removal with no loose ends.
One observation (out of scope for this PR): dot.google (com.dotcms.lib:dot.google:ukv_2) is still present in both pom files — it's a similar repackaged dependency. If it follows the same pattern as dot.guava, it may be worth evaluating for the same treatment in a follow-up.
Overall this is a straightforward import migration — low risk, high value. The build passing confirms no compile breaks. Approving.
dotCMS Backend Review[High]
// Line 41 -- not fixed; throws InvalidCacheLoadException on every cache miss
timeOfPublishing = (Long)cache.get(key, new NullCallable());
// Line 88 -- raw type
private class NullCallable implements Callable {Suggested fix: Replace line 41 with [Medium]
dbGroups.stream()
.filter(group -> updatedGroups.contains(group.getId())) // wrong: keeps, not removes
.map(this::deleteRemovedGroupFromRule); // no terminal op: never executesSuggested fix: Next steps
|
Replace all 222 occurrences of com.dotcms.repackage.com.google.common.* imports with standard com.google.common.* equivalents, then remove the com.dotcms.lib:dot.guava:11.0.1_2 artifact from dotCMS/pom.xml and BOM. Two API compatibility fixes required for the Guava 32 upgrade: - Objects.toStringHelper() removed in Guava 20 → MoreObjects.toStringHelper() - Cache.get(key) removed in Guava 22 → Cache.getIfPresent(key) Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
…sts (refs #35235) 18 integration test files in dotcms-integration/src/test/java were missed in the initial migration. Replace all remaining com.dotcms.repackage.com.google.* imports with standard com.google.* equivalents. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
ee0cffd to
e5151a8
Compare
Summary
com.dotcms.repackage.com.google.common.*imports with standardcom.google.common.*equivalents across the codebase (222 indotCMS/src, 18 indotcms-integration/src)com.dotcms.lib:dot.guava:11.0.1_2fromdotCMS/pom.xmlandbom/application/pom.xmlObjects.toStringHelper()→MoreObjects.toStringHelper()(removed in Guava 20)Cache.get(key)→Cache.getIfPresent(key)(removed in Guava 22)Closes #35235 (partial — companion to the OWASP dependency upgrade PR)
Motivation
dot.guavawas a dotCMS-repackaged version of Guava 11.0.1 that provided acom.dotcms.repackage.com.google.common.*namespace alongside the standardcom.google.guava:guavaartifact. Both coexisted on the classpath. Now that guava has been upgraded to 32.0.1-jre,dot.guavais redundant and its old APIs are a liability.Test plan
./mvnw install -pl :dotcms-core -DskipTests— BUILD SUCCESScom.dotcms.repackage.com.googlereferences remain:grep -r "com.dotcms.repackage.com.google" dotCMS/src dotcms-integration/src --include="*.java"→ 0 resultsRulesAPIImpl,RulesFactoryImpl, conditionlets🤖 Generated with Claude Code