[java] fixing not-null instrumentation of static interface methods (IDEA-229070)

GitOrigin-RevId: d419d4a1fcec36a86b1979a2feee50cb1fa70faf
This commit is contained in:
Roman Shevchenko
2019-12-18 22:04:32 +00:00
committed by intellij-monorepo-bot
parent 9c42c316c8
commit 2c34ddf4c9
3 changed files with 23 additions and 20 deletions
@@ -0,0 +1,11 @@
import org.jetbrains.annotations.NotNull;
public class InterfaceStaticMethodParameter {
public static void test() {
I.test(null);
}
interface I {
static void test(@NotNull String s) { }
}
}
@@ -380,6 +380,13 @@ public abstract class NotNullVerifyingInstrumenterTest {
verifyNotInstrumented();
}
@Test
public void testInterfaceStaticMethodParameter() throws Exception {
Class<?> testClass = prepareTest();
Method method = testClass.getMethod("test");
verifyCallThrowsException("Argument 0 for @NotNull parameter of InterfaceStaticMethodParameter$I.test must not be null", null, method);
}
protected static void verifyCallThrowsException(String expectedError, @Nullable Object instance, Member member, Object... args) throws Exception {
String exceptionText = null;
try {