Skip to content

Commit 5fa727a

Browse files
cpovirkError Prone Team
authored and
Error Prone Team
committed
Actually test that hasExtraParameterForEnclosingInstance works.
It does, but I got confused in #4225. PiperOrigin-RevId: 594123682
1 parent 21c190a commit 5fa727a

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

core/src/test/java/com/google/errorprone/bugpatterns/nullness/NullArgumentForNonNullParameterTest.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,4 +218,22 @@ public void negativeNullMarkedTypeVariable() {
218218
"}")
219219
.doTest();
220220
}
221+
222+
@Test
223+
public void negativePrimitiveButEnclosingClass() {
224+
conservativeHelper
225+
.addSourceLines(
226+
"Foo.java",
227+
"import java.util.Optional;",
228+
"class Foo {",
229+
" class Bar {",
230+
" Bar(int i) {}",
231+
" }",
232+
" void foo(Optional<Integer> o) {",
233+
// It would be nice to catch this, but for now, at least, we don't.
234+
" new Bar(o.orElse(null));",
235+
" }",
236+
"}")
237+
.doTest();
238+
}
221239
}

0 commit comments

Comments
 (0)