diff --git a/nullaway/src/test/java/com/uber/nullaway/jspecify/GenericsTests.java b/nullaway/src/test/java/com/uber/nullaway/jspecify/GenericsTests.java index 74a7ef481f..bbf4140a4d 100644 --- a/nullaway/src/test/java/com/uber/nullaway/jspecify/GenericsTests.java +++ b/nullaway/src/test/java/com/uber/nullaway/jspecify/GenericsTests.java @@ -2002,6 +2002,30 @@ public void issue1019() { .doTest(); } + @Test + public void issue1082() { + makeHelper() + .addSourceLines( + "Main.java", + "package com.uber;", + "import java.util.Optional;", + "public class Main {", + " public interface Factory {", + " T create();", + " }", + " public interface Expiry {}", + " static class Config {", + " Config setFactory(Optional>> factory) {", + " return null;", + " }", + " }", + " static void caller(Config config) {", + " config.setFactory(Optional.empty());", + " }", + "}") + .doTest(); + } + private CompilationTestHelper makeHelper() { return makeTestHelperWithArgs( Arrays.asList(