Skip to content

Commit

Permalink
Make NoCanIgnoreReturnValueOnClasses non-suppressible.
Browse files Browse the repository at this point in the history
#checkreturnvalue

PiperOrigin-RevId: 506882237
  • Loading branch information
kluever authored and Error Prone Team committed Feb 3, 2023
1 parent ea28574 commit a010209
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,13 @@
import java.lang.annotation.Target;

/**
* Indicates that the return value of the annotated API(s) can be safely ignored.
* Indicates that the return value of the annotated API is ignorable.
*
* <p>This is the opposite of {@link CheckReturnValue}. It can be used inside classes or packages
* annotated with {@code @CheckReturnValue} to exempt specific APIs from the default.
*/
@Documented
// Note: annotating a type with @CanIgnoreReturnValue is discouraged (and banned inside of Google)
@Target({METHOD, CONSTRUCTOR, TYPE})
@Retention(CLASS)
public @interface CanIgnoreReturnValue {}
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@
"@CanIgnoreReturnValue should not be applied to classes as it almost always overmatches (as"
+ " it applies to constructors and all methods), and the CIRVness isn't conferred to"
+ " its subclasses.",
documentSuppression = false,
suppressionAnnotations = {},
severity = ERROR)
public final class NoCanIgnoreReturnValueOnClasses extends BugChecker implements ClassTreeMatcher {
private static final String CRV = "com.google.errorprone.annotations.CheckReturnValue";
Expand Down

0 comments on commit a010209

Please sign in to comment.