Skip to content

Commit

Permalink
test case
Browse files Browse the repository at this point in the history
  • Loading branch information
msridhar committed Dec 9, 2024
1 parent 2718d42 commit 70a4453
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ public Boolean visitClassType(Type.ClassType lhsType, Type rhsType) {
// The base type of rhsType may be a subtype of lhsType's base type. In such cases, we must
// compare lhsType against the supertype of rhsType with a matching base type.
Type rhsTypeAsSuper = types.asSuper(rhsType, lhsType.tsym);
// This is impossible, considering the fact that standard Java subtyping succeeds before
// running NullAway
if (rhsTypeAsSuper == null) {
throw new RuntimeException("Did not find supertype of " + rhsType + " matching " + lhsType);
// Surprisingly, this can in fact occur, in cases involving raw types. See, e.g.,
// GenericsTests#issue1082. Bail out.
return true;
}
// bail out of checking raw types for now
if (rhsTypeAsSuper.isRaw()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2016,11 +2016,13 @@ public void issue1082() {
" public interface Expiry<K, V> {}",
" static class Config<K, V> {",
" Config<K, V> setFactory(Optional<Factory<? extends Expiry<K, V>>> factory) {",
" // BUG: Diagnostic contains: returning @Nullable expression from method",
" return null;",
" }",
" }",
" static void caller(Config config) {",
" config.setFactory(Optional.empty());",
" // checking that we don't crash",
" config.setFactory(Optional.<Object>empty());",
" }",
"}")
.doTest();
Expand Down

0 comments on commit 70a4453

Please sign in to comment.