From 2718d42ae44cb861f4ea37252ea5951cd6dbc393 Mon Sep 17 00:00:00 2001 From: Manu Sridharan Date: Sun, 8 Dec 2024 17:33:32 -0800 Subject: [PATCH] test case --- .../uber/nullaway/jspecify/GenericsTests.java | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) 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(