diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2014-05-20 12:31:00 +0200 |
---|---|---|
committer | Jason Zaugg <jzaugg@gmail.com> | 2014-05-20 12:31:00 +0200 |
commit | 7892bbf38fb77e7d2f1361515f14280b3a513c96 (patch) | |
tree | 098b2d82969f0f78e8520db74eaa8bc519e03c06 /test/files/run/t8601e | |
parent | 51c60a93009c4470343888e424f58229ecf52ec6 (diff) | |
download | scala-7892bbf38fb77e7d2f1361515f14280b3a513c96.tar.gz scala-7892bbf38fb77e7d2f1361515f14280b3a513c96.tar.bz2 scala-7892bbf38fb77e7d2f1361515f14280b3a513c96.zip |
SI-8601 Test that static LOAD_FIELD is not eliminated
This test fails under 2.11.0, and works now that DCE treats
static loads as useful instructions.
Diffstat (limited to 'test/files/run/t8601e')
-rw-r--r-- | test/files/run/t8601e/StaticInit.class | bin | 0 -> 417 bytes | |||
-rw-r--r-- | test/files/run/t8601e/StaticInit.java | 8 | ||||
-rw-r--r-- | test/files/run/t8601e/Test.scala | 12 |
3 files changed, 20 insertions, 0 deletions
diff --git a/test/files/run/t8601e/StaticInit.class b/test/files/run/t8601e/StaticInit.class Binary files differnew file mode 100644 index 0000000000..99a0e2a643 --- /dev/null +++ b/test/files/run/t8601e/StaticInit.class diff --git a/test/files/run/t8601e/StaticInit.java b/test/files/run/t8601e/StaticInit.java new file mode 100644 index 0000000000..7543ed98b8 --- /dev/null +++ b/test/files/run/t8601e/StaticInit.java @@ -0,0 +1,8 @@ +public class StaticInit { + static { + if ("".isEmpty()) { + throw new RuntimeException(); + } + } + public static int fld = 42; +} diff --git a/test/files/run/t8601e/Test.scala b/test/files/run/t8601e/Test.scala new file mode 100644 index 0000000000..838114f6a7 --- /dev/null +++ b/test/files/run/t8601e/Test.scala @@ -0,0 +1,12 @@ +class C { + def foo: Unit = {StaticInit.fld} +} + +object Test extends App { + try { + new C().foo + sys.error("StaticInit.<clinit> was not run!") + } catch { + case t: ExceptionInInitializerError => + } +} |