Skip to content

Commit

Permalink
docs
Browse files Browse the repository at this point in the history
  • Loading branch information
msridhar committed Dec 6, 2023
1 parent e58773b commit 779cd8c
Showing 1 changed file with 6 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ public Nullness onOverrideMethodReturnNullability(
}

/**
* Propagate @Nullable to the first argument of Lombok-generated equals methods, since Lombok does
* not generate a @Nullable annotation for this argument.
* Mark the first argument of Lombok-generated {@code equals} methods as {@code @Nullable}, since
* Lombok does not generate the annotation.
*/
@Override
public Nullness[] onOverrideMethodInvocationParametersNullability(
Expand All @@ -98,15 +98,11 @@ public Nullness[] onOverrideMethodInvocationParametersNullability(
boolean isAnnotated,
Nullness[] argumentPositionNullness) {
if (ASTHelpers.hasAnnotation(methodSymbol, LOMBOK_GENERATED_ANNOTATION_NAME, state)) {
// We assume that Lombok-generated equals methods with a single argument override
// Object.equals and are not an overload.
if (methodSymbol.getSimpleName().contentEquals("equals")
&& methodSymbol.params().size() == 1
&& methodSymbol
.asType()
.getParameterTypes()
.get(0)
.toString()
.equals("java.lang.Object")) {
// Lombok-generated equals method is not annotated with @Nullable, but it should be.
&& methodSymbol.params().size() == 1) {
// The parameter is not annotated with @Nullable, but it should be.
argumentPositionNullness[0] = Nullness.NULLABLE;

Check warning on line 106 in nullaway/src/main/java/com/uber/nullaway/handlers/LombokHandler.java

View check run for this annotation

Codecov / codecov/patch

nullaway/src/main/java/com/uber/nullaway/handlers/LombokHandler.java#L106

Added line #L106 was not covered by tests
}
}
Expand Down

0 comments on commit 779cd8c

Please sign in to comment.