Fix AbstractLoadingCache class Javadoc to describe its own behavior#8391
Open
daguimu wants to merge 1 commit into
Open
Fix AbstractLoadingCache class Javadoc to describe its own behavior#8391daguimu wants to merge 1 commit into
daguimu wants to merge 1 commit into
Conversation
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
Felipe2020Able
approved these changes
Apr 30, 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
AbstractLoadingCache's class-level Javadoc is a near-verbatim copy ofAbstractCache's and describes methods thatAbstractLoadingCachedoes not actually contribute. For example, it claims thatgetAllPresent,putAll,invalidateAll(Iterable),cleanUpare pre-implemented here, and thatget(Object, Callable)is implemented in terms ofget. None of those statements are accurate for this class:getAllPresent,putAll,invalidateAll(Iterable), andcleanUpare inherited unchanged fromAbstractCache.get(Object, Callable)is inherited fromAbstractCachewhere it throwsUnsupportedOperationException-- it is not implemented in terms ofget.This was already noted in #1871 (now closed) and is the subject of #2862.
Root Cause
When
AbstractLoadingCachewas added, the class-level Javadoc appears to have been copied fromAbstractCachewithout being adapted to describe the loading-cache-specific surface that this class adds.Fix
Rewrite the class Javadoc so it talks about
LoadingCacheand only the methods this class actually defines:getUncheckedandgetAllare implemented in terms ofget.applyis implemented in terms ofgetUnchecked.refreshthrowsUnsupportedOperationException.getAllPresent,putAll,invalidateAll(Iterable),cleanUp,put,invalidate,size,stats,asMap,get(K, Callable)), the doc points the reader toAbstractCache.The same Javadoc lives in both
guava/andandroid/guava/; both copies are updated and remain identical.The now-unused
java.util.concurrent.Callableimport (referenced only by the old Javadoc) is removed.No behavior change; documentation only.
Closes #2862