From d700ee38603598c894fab00d8b3d4f7eb9df8130 Mon Sep 17 00:00:00 2001 From: mauricioaniche Date: Wed, 25 Sep 2024 16:56:50 +0200 Subject: [PATCH] Throw exception instead of returning default value in exceptional case --- .../contract/fieldcontract/EnsuresNonNullIfHandler.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nullaway/src/main/java/com/uber/nullaway/handlers/contract/fieldcontract/EnsuresNonNullIfHandler.java b/nullaway/src/main/java/com/uber/nullaway/handlers/contract/fieldcontract/EnsuresNonNullIfHandler.java index 3cf989587b..52ef489bbc 100644 --- a/nullaway/src/main/java/com/uber/nullaway/handlers/contract/fieldcontract/EnsuresNonNullIfHandler.java +++ b/nullaway/src/main/java/com/uber/nullaway/handlers/contract/fieldcontract/EnsuresNonNullIfHandler.java @@ -183,7 +183,7 @@ public void onDataflowVisitReturn( private boolean getTrueIfNonNullValue(Symbol.MethodSymbol methodSymbol) { AnnotationMirror annot = NullabilityUtil.findAnnotation(methodSymbol, annotName, false); if (annot == null) { - return true; + throw new RuntimeException("Annotation should not be null at this point"); } Map elementValues =