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
@@ -38,8 +38,6 @@ public class StringsTest extends CodegenTestCase {
// System.out.println(generateToText());
Method foo = generateFunction();
assertEquals("something", foo.invoke(null, "something"));
assertEquals("null", foo.invoke(null, new Object[]{null}));
}
public void testNullableAnyToString () throws InvocationTargetException, IllegalAccessException {
@@ -71,9 +69,7 @@ public class StringsTest extends CodegenTestCase {
// System.out.println(text);
Method foo = generateFunction();
assertEquals("something239120", foo.invoke(null, "something", 239));
assertEquals("null239120", foo.invoke(null, null, 239));
assertEquals("239null120", foo.invoke(null, "239", null));
assertEquals("nullnull120", foo.invoke(null, null, null));
}