From 8b7c174afd336307c261f5d1dd3cdf5751dbe8ed Mon Sep 17 00:00:00 2001 From: David Schlosnagle Date: Fri, 7 Oct 2022 13:02:32 -0400 Subject: [PATCH] checkerframework 3.26.0 (#671) Updates NullAway to use recently released [checkerframework 3.26.0](https://github.com/typetools/checker-framework/releases/tag/checker-framework-3.26.0) to resolve ABI breaks in checkerframework. Closes https://github.com/uber/NullAway/issues/670 Co-authored-by: Manu Sridharan --- gradle/dependencies.gradle | 2 +- .../nullaway/dataflow/AccessPathNullnessPropagation.java | 7 ++++--- .../java/com/uber/nullaway/dataflow/NullnessStore.java | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/gradle/dependencies.gradle b/gradle/dependencies.gradle index 6d7a7a758d..5d6ffa9c5e 100755 --- a/gradle/dependencies.gradle +++ b/gradle/dependencies.gradle @@ -41,7 +41,7 @@ if (project.hasProperty("epApiVersion")) { def versions = [ asm : "9.3", - checkerFramework : "3.24.0", + checkerFramework : "3.26.0", // for comparisons in other parts of the build errorProneLatest : latestErrorProneVersion, // The version of Error Prone used to check NullAway's code. diff --git a/nullaway/src/main/java/com/uber/nullaway/dataflow/AccessPathNullnessPropagation.java b/nullaway/src/main/java/com/uber/nullaway/dataflow/AccessPathNullnessPropagation.java index c0f9b79c56..19e7f3c2b1 100644 --- a/nullaway/src/main/java/com/uber/nullaway/dataflow/AccessPathNullnessPropagation.java +++ b/nullaway/src/main/java/com/uber/nullaway/dataflow/AccessPathNullnessPropagation.java @@ -676,8 +676,8 @@ private static boolean hasPrimitiveType(Node node) { } private static boolean hasNonNullConstantValue(LocalVariableNode node) { - if (node.getElement() instanceof VariableElement) { - VariableElement element = (VariableElement) node.getElement(); + VariableElement element = node.getElement(); + if (element != null) { return (element.getConstantValue() != null); } return false; @@ -695,7 +695,8 @@ public TransferResult visitLocalVariable( } private static boolean isCatchVariable(VariableDeclarationNode node) { - return elementFromDeclaration(node.getTree()).getKind() == EXCEPTION_PARAMETER; + VariableElement variableElement = elementFromDeclaration(node.getTree()); + return variableElement != null && variableElement.getKind() == EXCEPTION_PARAMETER; } @Override diff --git a/nullaway/src/main/java/com/uber/nullaway/dataflow/NullnessStore.java b/nullaway/src/main/java/com/uber/nullaway/dataflow/NullnessStore.java index 3e545652d7..ea873bae59 100644 --- a/nullaway/src/main/java/com/uber/nullaway/dataflow/NullnessStore.java +++ b/nullaway/src/main/java/com/uber/nullaway/dataflow/NullnessStore.java @@ -188,7 +188,7 @@ public NullnessStore widenedUpperBound(NullnessStore vNullnessStore) { } @Override - public boolean equals(Object o) { + public boolean equals(@Nullable Object o) { if (!(o instanceof NullnessStore)) { return false; }