commit | bfdbe6064d1203fae3b70da76a572d5fc5577ca9 | [log] [tgz] |
---|---|---|
author | Christoffer Quist Adamsen <christofferqa@google.com> | Fri Oct 18 12:03:31 2019 +0200 |
committer | Christoffer Quist Adamsen <christofferqa@google.com> | Fri Oct 18 12:03:31 2019 +0200 |
tree | 49344c07fa0181f7fce4aa0471863abad54df8ac | |
parent | 46be366c34e8506201d0eaef977ff73f6d534c36 [diff] [blame] |
Allow clinits that create a singleton instance to be postponed Bug: 142762129 Change-Id: Iaa472dcf1b52dad304488ed3855fbceb16f20f9d
diff --git a/src/test/examplesAndroidO/classmerging/NestedDefaultInterfaceMethodsTest.java b/src/test/examplesAndroidO/classmerging/NestedDefaultInterfaceMethodsTest.java index 7a0e325..f237c2e 100644 --- a/src/test/examplesAndroidO/classmerging/NestedDefaultInterfaceMethodsTest.java +++ b/src/test/examplesAndroidO/classmerging/NestedDefaultInterfaceMethodsTest.java
@@ -7,7 +7,18 @@ public class NestedDefaultInterfaceMethodsTest { public static void main(String[] args) { - new C().m(); + C obj = new C(); + obj.m(); + + // Ensure that the instantiations are not dead code eliminated. + escape(obj); + } + + @NeverInline + static void escape(Object o) { + if (System.currentTimeMillis() < 0) { + System.out.println(o); + } } public interface A {