From dcade51d751b389fb5137040f7e1006b4bc633c6 Mon Sep 17 00:00:00 2001 From: Jason Zaugg Date: Sun, 18 May 2014 12:21:45 +0200 Subject: SI-8601 Test that `null.synchronized` NPEs under -optimize As part of my sweep through the side-effecting byte code instructions. --- test/files/run/t8601d.scala | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 test/files/run/t8601d.scala (limited to 'test/files/run/t8601d.scala') diff --git a/test/files/run/t8601d.scala b/test/files/run/t8601d.scala new file mode 100644 index 0000000000..ac89963d67 --- /dev/null +++ b/test/files/run/t8601d.scala @@ -0,0 +1,8 @@ +object Test { + def monitor(x: AnyRef): Unit = {x.synchronized(()); ()} + def check(x: => Any) = try { x; sys.error("failed to throw NPE") } catch { case _: NullPointerException => } + + def main(args: Array[String]) { + check(monitor(null)) + } +} -- cgit v1.2.3