summaryrefslogtreecommitdiffstats
path: root/jack-tests
diff options
context:
space:
mode:
authorMikael Peltier <mikaelpeltier@google.com>2014-09-11 12:56:18 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2014-09-11 12:56:18 +0000
commit9ec449eafdd094ec573b339f658dfde62cf09caa (patch)
treeccb89065fa93ecab162c2a1fd54a076ad1c2033d /jack-tests
parent521e38161b2a1e17381b266913e5c53df616b945 (diff)
parent0dfc1c33422f575d8e1536ba7c32f3fa982c616e (diff)
downloadtoolchain_jack-9ec449eafdd094ec573b339f658dfde62cf09caa.zip
toolchain_jack-9ec449eafdd094ec573b339f658dfde62cf09caa.tar.gz
toolchain_jack-9ec449eafdd094ec573b339f658dfde62cf09caa.tar.bz2
Merge "Fix illegal code generation of TryWithResourcesTransformer" into ub-jack
Diffstat (limited to 'jack-tests')
-rw-r--r--jack-tests/tests/com/android/jack/java7/trywithresources/test002/dx/Tests.java5
-rw-r--r--jack-tests/tests/com/android/jack/java7/trywithresources/test002/jack/TryWithResourcesTest002.java24
2 files changed, 29 insertions, 0 deletions
diff --git a/jack-tests/tests/com/android/jack/java7/trywithresources/test002/dx/Tests.java b/jack-tests/tests/com/android/jack/java7/trywithresources/test002/dx/Tests.java
index aa47320..641274d 100644
--- a/jack-tests/tests/com/android/jack/java7/trywithresources/test002/dx/Tests.java
+++ b/jack-tests/tests/com/android/jack/java7/trywithresources/test002/dx/Tests.java
@@ -91,4 +91,9 @@ import org.junit.Test;
public void test013() {
Assert.assertTrue(TryWithResourcesTest002.m13());
}
+
+ @Test
+ public void test014() throws Exception {
+ Assert.assertTrue(TryWithResourcesTest002.m14(1));
+ }
}
diff --git a/jack-tests/tests/com/android/jack/java7/trywithresources/test002/jack/TryWithResourcesTest002.java b/jack-tests/tests/com/android/jack/java7/trywithresources/test002/jack/TryWithResourcesTest002.java
index 5b9ea0e..6a58bc3 100644
--- a/jack-tests/tests/com/android/jack/java7/trywithresources/test002/jack/TryWithResourcesTest002.java
+++ b/jack-tests/tests/com/android/jack/java7/trywithresources/test002/jack/TryWithResourcesTest002.java
@@ -270,4 +270,28 @@ public class TryWithResourcesTest002 {
return result;
}
+ private static boolean getMaybeThrow(int condition) throws E1 {
+ if (condition < 5) {
+ return true;
+ } else if (condition > 15) {
+ return false;
+ }
+ throw new E1();
+ }
+
+ public static boolean m14(int condition) throws Exception {
+ Observer o1 = new Observer();
+ try (
+ AutoCloseable001 ac1 = new AutoCloseable001(o1);
+ ) {
+ if (condition < 10) {
+ return getMaybeThrow(condition + 2);
+ }
+ return getMaybeThrow(condition);
+ // No exception
+ } catch (E1 e) {
+ return getMaybeThrow(condition - 10);
+ }
+ }
+
}