diff --git a/nullaway/src/main/java/com/uber/nullaway/generics/CheckIdenticalNullabilityVisitor.java b/nullaway/src/main/java/com/uber/nullaway/generics/CheckIdenticalNullabilityVisitor.java index 432d53e939..5f1bac2742 100644 --- a/nullaway/src/main/java/com/uber/nullaway/generics/CheckIdenticalNullabilityVisitor.java +++ b/nullaway/src/main/java/com/uber/nullaway/generics/CheckIdenticalNullabilityVisitor.java @@ -40,6 +40,10 @@ public Boolean visitClassType(Type.ClassType lhsType, Type rhsType) { if (rhsTypeAsSuper == null) { throw new RuntimeException("Did not find supertype of " + rhsType + " matching " + lhsType); } + // bail out of checking raw types for now + if (rhsTypeAsSuper.isRaw()) { + return true; + } List lhsTypeArguments = lhsType.getTypeArguments(); List rhsTypeArguments = rhsTypeAsSuper.getTypeArguments(); // This is impossible, considering the fact that standard Java subtyping succeeds before 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 869f736790..17932cf92c 100644 --- a/nullaway/src/test/java/com/uber/nullaway/jspecify/GenericsTests.java +++ b/nullaway/src/test/java/com/uber/nullaway/jspecify/GenericsTests.java @@ -1928,6 +1928,26 @@ public void issue1014() { .doTest(); } + @Test + public void issue1019() { + makeHelper() + .addSourceLines( + "Test.java", + "package com.uber;", + "import java.util.ArrayList;", + "import java.util.List;", + "", + "public class Test {", + " public static class StringList extends ArrayList {", + " }", + " @SuppressWarnings(\"unchecked\")", + " public static List convert(final StringList stringList) {", + " return stringList;", + " }", + "}") + .doTest(); + } + private CompilationTestHelper makeHelper() { return makeTestHelperWithArgs( Arrays.asList(