Skip to content

Commit dcade51

Browse files
committed
SI-8601 Test that null.synchronized NPEs under -optimize
As part of my sweep through the side-effecting byte code instructions.
1 parent 70b912a commit dcade51

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

test/files/run/t8601d.flags

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
-optimize

test/files/run/t8601d.scala

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
object Test {
2+
def monitor(x: AnyRef): Unit = {x.synchronized(()); ()}
3+
def check(x: => Any) = try { x; sys.error("failed to throw NPE") } catch { case _: NullPointerException => }
4+
5+
def main(args: Array[String]) {
6+
check(monitor(null))
7+
}
8+
}

0 commit comments

Comments
 (0)