Skip to content

Fix AbstractLoadingCache class Javadoc to describe its own behavior#8391

Open
daguimu wants to merge 1 commit into
google:masterfrom
daguimu:fix/abstractloadingcache-javadoc-2862
Open

Fix AbstractLoadingCache class Javadoc to describe its own behavior#8391
daguimu wants to merge 1 commit into
google:masterfrom
daguimu:fix/abstractloadingcache-javadoc-2862

Conversation

@daguimu

@daguimu daguimu commented Apr 29, 2026

Copy link
Copy Markdown

Problem

AbstractLoadingCache's class-level Javadoc is a near-verbatim copy of AbstractCache's and describes methods that AbstractLoadingCache does not actually contribute. For example, it claims that getAllPresent, putAll, invalidateAll(Iterable), cleanUp are pre-implemented here, and that get(Object, Callable) is implemented in terms of get. None of those statements are accurate for this class:

  • getAllPresent, putAll, invalidateAll(Iterable), and cleanUp are inherited unchanged from AbstractCache.
  • get(Object, Callable) is inherited from AbstractCache where it throws UnsupportedOperationException -- it is not implemented in terms of get.

This was already noted in #1871 (now closed) and is the subject of #2862.

Root Cause

When AbstractLoadingCache was added, the class-level Javadoc appears to have been copied from AbstractCache without being adapted to describe the loading-cache-specific surface that this class adds.

Fix

Rewrite the class Javadoc so it talks about LoadingCache and only the methods this class actually defines:

  • getUnchecked and getAll are implemented in terms of get.
  • apply is implemented in terms of getUnchecked.
  • refresh throws UnsupportedOperationException.
  • For everything inherited (getAllPresent, putAll, invalidateAll(Iterable), cleanUp, put, invalidate, size, stats, asMap, get(K, Callable)), the doc points the reader to AbstractCache.

The same Javadoc lives in both guava/ and android/guava/; both copies are updated and remain identical.

The now-unused java.util.concurrent.Callable import (referenced only by the old Javadoc) is removed.

No behavior change; documentation only.

Closes #2862

The class doc was a near-verbatim copy of `AbstractCache`'s, so it
referenced methods that `AbstractLoadingCache` does not actually
implement (e.g., `get(Object, Callable)` is inherited from `AbstractCache`
where it throws `UnsupportedOperationException`, not implemented in
terms of `get`). Update the doc to reflect what this class actually
adds (`getUnchecked`/`getAll`/`apply`) and to defer to
`AbstractCache`'s doc for the inherited behavior.

Closes google#2862
@kluever kluever added type=api-docs Change/add API documentation package=cache P3 no SLO labels May 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P3 no SLO package=cache type=api-docs Change/add API documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix the javadoc of AbstractLoadingCache

3 participants