Generate not-null assertions on method parameters

Intrinsics.checkParameterIsNotNull() gets its caller's class and method names
from the stack trace to render them in an exception message.

Fix codegen tests because now it's now allowed to pass null to non-null
argument in tests
This commit is contained in:
Alexander Udalov
2012-10-04 15:46:25 +04:00
parent 753ae9e550
commit c9984c3d06
10 changed files with 108 additions and 9 deletions
@@ -0,0 +1,17 @@
package test;
import org.jetbrains.annotations.NotNull;
public abstract class doGenerateParamAssertions {
public abstract void bar(@NotNull String s);
public static String foo(doGenerateParamAssertions a) {
try {
a.bar(null);
} catch (IllegalArgumentException e) {
return "OK";
}
return "Fail: AssertionError expected";
}
}