diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2014-05-18 12:21:45 +0200 |
---|---|---|
committer | Jason Zaugg <jzaugg@gmail.com> | 2014-05-18 12:21:45 +0200 |
commit | dcade51d751b389fb5137040f7e1006b4bc633c6 (patch) | |
tree | f569bc4f3f57279fbcb68e67f72110c3fffb7af0 | |
parent | 70b912a87433c9589af33e4f8b33dca39abb66e5 (diff) | |
download | scala-dcade51d751b389fb5137040f7e1006b4bc633c6.tar.gz scala-dcade51d751b389fb5137040f7e1006b4bc633c6.tar.bz2 scala-dcade51d751b389fb5137040f7e1006b4bc633c6.zip |
SI-8601 Test that `null.synchronized` NPEs under -optimize
As part of my sweep through the side-effecting byte code instructions.
-rw-r--r-- | test/files/run/t8601d.flags | 1 | ||||
-rw-r--r-- | test/files/run/t8601d.scala | 8 |
2 files changed, 9 insertions, 0 deletions
diff --git a/test/files/run/t8601d.flags b/test/files/run/t8601d.flags new file mode 100644 index 0000000000..1182725e86 --- /dev/null +++ b/test/files/run/t8601d.flags @@ -0,0 +1 @@ +-optimize
\ No newline at end of file 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)) + } +} |