google / google/error-prone

MutableMethodReturnType documentation should mention that the warning may not apply to APIs.

Open
#982 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
7.2k
Forks
820
Avg merge
5h 9m
Merged PRs (30d)
50

Description

Error Prone 2.2.0 can report the warning MutableMethodReturnType on public methods that are part of an API. For example, it can suggest changing a return type from `Collection` to `ImmutableCollection`, where `ImmutableCollection` is a class from Guava. However, the advice in the MutableMethodReturnType [documentation](https://github.com/google/error-prone/blob/d7845cb7f9c82a6e3fef772128d001f5e6fb2633/docs/bugpattern/MutableMethodReturnType.md) may not apply to API methods if the library depends on Guava but avoids exposing Guava types in its API. There are several reasons for a library to not expose Guava, including shading and giving the library the flexibility to change the collection implementation or remove the Guava dependency in the future.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.