From 054aab2f1d5db343add01a09bc9bb228993b1c9b Mon Sep 17 00:00:00 2001 From: Manu Sridharan Date: Sat, 12 Aug 2023 15:02:01 -0700 Subject: [PATCH] rewrite condition for clarity --- nullaway/src/main/java/com/uber/nullaway/NullAway.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/nullaway/src/main/java/com/uber/nullaway/NullAway.java b/nullaway/src/main/java/com/uber/nullaway/NullAway.java index 3d73186678..6a1d4f109b 100644 --- a/nullaway/src/main/java/com/uber/nullaway/NullAway.java +++ b/nullaway/src/main/java/com/uber/nullaway/NullAway.java @@ -984,10 +984,12 @@ private boolean overriddenMethodReturnsNonNull( } // In JSpecify mode, for generic methods, we additionally need to check the return nullness // using the type parameters from the type enclosing the overriding method - return !config.isJSpecifyMode() - || GenericsChecks.getGenericMethodReturnTypeNullness( - overriddenMethod, overridingMethodType, state, config) - .equals(Nullness.NONNULL); + if (config.isJSpecifyMode()) { + return GenericsChecks.getGenericMethodReturnTypeNullness( + overriddenMethod, overridingMethodType, state, config) + .equals(Nullness.NONNULL); + } + return true; } @Override