blob: c487d6825ef5f94f373c51d166fc83fcc8102059 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
|
object Test {
def loadField(x: scala.runtime.IntRef): Unit = x.elem
def storeField(x: scala.runtime.IntRef): Unit = x.elem = 42
def check(x: => Any) = try { x; sys.error("failed to throw NPE!") } catch { case _: NullPointerException => }
def main(args: Array[String]) {
check(loadField(null)) // bug: did not NPE under -Ydead-code
check(storeField(null))
}
}
|