summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMathieu Chartier <mathieuc@google.com>2015-12-02 13:53:46 -0800
committerEric Bae <eric.bae@lge.com>2015-12-10 18:26:29 +0000
commit161ab7af0434978ad3a9512293a032861a18e16e (patch)
treeb7b5b1b45ca84eb806fd00ca9a99330a73305939
parent11173387202f799fad05bf696b81ca7f379e11dc (diff)
downloadlibcore-161ab7af0434978ad3a9512293a032861a18e16e.zip
libcore-161ab7af0434978ad3a9512293a032861a18e16e.tar.gz
libcore-161ab7af0434978ad3a9512293a032861a18e16e.tar.bz2
Change FinalizeTest to use helper function
Old way kept the object live in a vreg. Bug: 25851249 (cherry picked from commit cf3d432790a78b7d81da656f9a666f3d1ce4962c) Change-Id: I3cefd317e23c602c6c74dd866f0831161ef10962 (cherry picked from commit 8210c23a598b363e89d6cd32dedeeae673bf9212)
-rw-r--r--luni/src/test/java/libcore/java/lang/ref/FinalizeTest.java9
1 files changed, 7 insertions, 2 deletions
diff --git a/luni/src/test/java/libcore/java/lang/ref/FinalizeTest.java b/luni/src/test/java/libcore/java/lang/ref/FinalizeTest.java
index ef303bd..d71b5b0 100644
--- a/luni/src/test/java/libcore/java/lang/ref/FinalizeTest.java
+++ b/luni/src/test/java/libcore/java/lang/ref/FinalizeTest.java
@@ -69,13 +69,18 @@ public final class FinalizeTest extends TestCase {
static class X {}
- // http://b/issue?id=2136462
- public void testBackFromTheDead() throws Exception {
+ // Helper function since we do not want a vreg to keep the allocated object live.
+ // For b/25851249
+ private void exceptionInConstructor() {
try {
new ConstructionFails();
} catch (AssertionError expected) {
}
+ }
+ // http://b/issue?id=2136462
+ public void testBackFromTheDead() throws Exception {
+ exceptionInConstructor();
FinalizationTester.induceFinalization();
assertTrue("object whose constructor threw was not finalized", ConstructionFails.finalized);
}