Skip to content

feat(aem-cloud-service): add guava-cache analyzer detector + expert skill - #326

Closed
bharat941 wants to merge 1 commit into
adobe:mainfrom
bharat941:feat/guava-cache-code-assessment
Closed

feat(aem-cloud-service): add guava-cache analyzer detector + expert skill#326
bharat941 wants to merge 1 commit into
adobe:mainfrom
bharat941:feat/guava-cache-code-assessment

Conversation

@bharat941

Copy link
Copy Markdown
Contributor

Adds the guava-cache code-assessment pattern — Guava cache (com.google.common.cache.*) → Caffeine (com.github.benmanes.caffeine.cache.*) on AEM as a Cloud Service. Follows the references/adding-a-pattern.md procedure; the slug guava-cache is wired into all four required places so the [wiring] test stays green.

Changes

  • Detector — scripts/analyzer/detectors/GuavaCache.java, registered in Registry.all(). Import-anchored on com.google.common.cache.* (Java-only). Exact package prefix means the io.micrometer…GuavaCacheMetrics BPA false positive is not flagged.
  • Expert skill — guava-cache/SKILL.md (control plane) + guava-cache/recipe.md (C1 pom swap, C2 imports, C3 builder/API mapping incl. getUncheckedget, CallableFunction, RemovalNotification→3-arg; test generation).
  • Catalog + routing — references/patterns.md row (low | ready | analyzer | guided) and Manual Pattern Hints row in code-assessment/SKILL.md.
  • Fixtures + test — test/code-assessment/fixtures/guava-cache/ (legacy guava / clean caffeine / micrometer guard) + a block in run-tests.sh.

Test Plan

run-tests.sh — 109 PASS / 0 FAIL (incl. [wiring] and the new [guava-cache] block). Detector flags com.google.common.cache.* imports; does not flag Caffeine or GuavaCacheMetrics. End-to-end on a real legacy AEM project: analyzer detects → recipe transform applied → analyzer re-scan clean → mvn compile BUILD SUCCESS.

…kill

Adds the guava-cache code-assessment pattern (Guava cache -> Caffeine on AEM CS):

- GuavaCache detector: import-anchored on com.google.common.cache.* (Java-only),
  registered in Registry.all(); exact prefix avoids the micrometer GuavaCacheMetrics
  false positive.
- guava-cache/ expert skill: SKILL.md (control plane) + recipe.md (C1 pom swap,
  C2 imports, C3 builder/API mapping, test generation).
- Catalog row in patterns.md (low | ready | analyzer | guided) + Manual Pattern Hints
  routing row in code-assessment SKILL.md.
- Fixtures (legacy guava / clean caffeine / micrometer guard) + run-tests.sh block.

Analyzer suite: 109 PASS / 0 FAIL (incl. [wiring] + guava block).

@rombert rombert left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR @bharat941

Two main comments:

  1. If Caffeine the officially recommended replacement from Adobe? We have this article that references Guava but there is no mention of Caffeine.
  2. Please remove comments from fixtures that explain if they should be flagged or not, this is not expected in real codebases.

@bharat941

Copy link
Copy Markdown
Contributor Author

Superseded by #331, re-raised from a branch on adobe/skills (identical commits) now that write access is available.

@bharat941 bharat941 closed this Sep 4, 2026
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