From f43a69aa896627766255a4e5968ea1f68852a486 Mon Sep 17 00:00:00 2001 From: Manu Sridharan Date: Sat, 31 Dec 2022 13:21:39 -0800 Subject: [PATCH] more tests and comments --- .../test/java/com/uber/nullaway/NullAwayCoreTests.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/nullaway/src/test/java/com/uber/nullaway/NullAwayCoreTests.java b/nullaway/src/test/java/com/uber/nullaway/NullAwayCoreTests.java index a468af61e0..5c9df89f45 100644 --- a/nullaway/src/test/java/com/uber/nullaway/NullAwayCoreTests.java +++ b/nullaway/src/test/java/com/uber/nullaway/NullAwayCoreTests.java @@ -1083,10 +1083,20 @@ public void typeUseAnnotationOnArray() { .addSourceLines( "Test.java", "package com.uber;", + "import java.util.Set;", "import org.checkerframework.checker.nullness.qual.Nullable;", "class Test {", + " // ok only for backwards compat", " @Nullable Object[] foo1 = null;", + " // ok according to spec", " Object @Nullable[] foo2 = null;", + " // ok only for backwards compat", + " @Nullable Object [][] foo3 = null;", + " // ok according to spec", + " Object @Nullable [][] foo4 = null;", + " // NOT ok; @Nullable applies to first array dimension", + " // BUG: Diagnostic contains: assigning @Nullable expression", + " Object [] @Nullable [] foo5 = null;", "}") .doTest(); }