Skip to content

Conversation

@Tanush-Jain
Copy link

This pull request is addressing the issue of
"Cache's compute misreports the removal cause of a collected entry #7985"
so it adds comprehensive Javadoc documentation to the compute method in the Cache interface (guava/guava/src/com/google/common/cache/Cache.java). The method was previously undocumented, which was inconsistent with the detailed documentation provided for other methods in the interface.

Changes Made :

  1. Added detailed Javadoc comment to the compute method, describing its atomic behavior, parameters, return value, and exception handling.
  2. Included the @CanIgnoreReturnValue annotation for consistency with similar methods.
  3. Added the @SInCE 23.0 annotation to indicate the version when this method was introduced.
  4. Ensured the documentation style matches the existing Javadoc format in the file.

Testing:
No functional changes were made; this is purely a documentation update. Existing tests should continue to pass.

@google-cla
Copy link

google-cla bot commented Nov 8, 2025

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@Tanush-Jain Tanush-Jain force-pushed the Add-javadoc-cache-compute branch from 31b2079 to 2b1c39e Compare November 8, 2025 14:25
@netdpb
Copy link
Member

netdpb commented Nov 17, 2025

It looks like you're adding a compute method to Cache, not adding documentation to an existing method. Can you help me to understand what you're doing here?

@netdpb netdpb added type=api-docs Change/add API documentation package=cache labels Nov 17, 2025
@Tanush-Jain
Copy link
Author

So the compute method already exists in the cache interface from concurrentMap in the underlying implementation. tIt was adding comprehensive javadoc documentation to that existing method, as it was previously undocumented. Thus aligns with the issue #7985, which involves the method's behavior around removal causes.
If the method wasn't present before, that would be a separate issue. Was it supposed to be added as a new method? If the description doesn't give the understanding i would adjust the PR description for clarity.

@ben-manes
Copy link
Contributor

The compute method is part of the Cache.asMap() view and is javadoc’d by ConcurrentMap. The original issue is about an implementation bug in the view. There is no need for an api change.

@netdpb
Copy link
Member

netdpb commented Nov 18, 2025

So the compute method already exists in the cache interface from concurrentMap in the underlying implementation. tIt was adding comprehensive javadoc documentation to that existing method, as it was previously undocumented.

I don't think that's correct. Your pull request adds compute methods to the Cache interface and ForwardingCache class.

Thus aligns with the issue #7985, which involves the method's behavior around removal causes. If the method wasn't present before, that would be a separate issue. Was it supposed to be added as a new method? If the description doesn't give the understanding i would adjust the PR description for clarity.

That issue is about a method in LocalCache, which is a different class. And I don't think updating or adding Javadoc to an overriding method helps to solve that issue.

Thanks for your contribution, but I'm going to close this particular PR for now.

@netdpb netdpb closed this Nov 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants