Skip to content

Commit

Permalink
Fix consistency of isCovered() in CheckReturnValue
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 439392998
  • Loading branch information
nick-someone authored and Error Prone Team committed Apr 4, 2022
1 parent 2ea4d44 commit fba919b
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,9 @@ private static Optional<MethodSymbol> methodSymbol(ExpressionTree tree) {

@Override
public boolean isCovered(ExpressionTree tree, VisitorState state) {
return methodSymbol(tree).flatMap(CheckReturnValue::firstAnnotation).isPresent();
return methodSymbol(tree)
.map(m -> (checkAllConstructors && m.isConstructor()) || firstAnnotation(m).isPresent())
.orElse(false);
}

@Override
Expand Down

0 comments on commit fba919b

Please sign in to comment.