summaryrefslogtreecommitdiffstats
path: root/jack-tests
diff options
context:
space:
mode:
authormikaelpeltier <mikaelpeltier@google.com>2015-05-19 17:52:55 +0200
committerMikael Peltier <mikaelpeltier@google.com>2015-05-21 11:43:04 +0000
commit6f8866b42820efb83640abaae45c5f9dacb943c7 (patch)
treefadc0232d0d5555a1efcbbf0affd17d0b1317edb /jack-tests
parent2a9ba9420757bba501858d56eada436716fb0d41 (diff)
downloadtoolchain_jack-6f8866b42820efb83640abaae45c5f9dacb943c7.tar.gz
toolchain_jack-6f8866b42820efb83640abaae45c5f9dacb943c7.tar.bz2
toolchain_jack-6f8866b42820efb83640abaae45c5f9dacb943c7.zip
Do not remove type of 'null' expression otherwise type is lost
Bug: 19508222 Change-Id: I839ee69b454bf74dd93a6dffcb900c56fb68c3de (cherry picked from commit 731bf4c954500229d95fdacf424f7ccad6e5bdcf)
Diffstat (limited to 'jack-tests')
-rw-r--r--jack-tests/tests/com/android/jack/cast/CastTests.java12
-rw-r--r--jack-tests/tests/com/android/jack/cast/explicit002/dx/Tests.java37
-rw-r--r--jack-tests/tests/com/android/jack/cast/explicit002/jack/Explicit002.java27
3 files changed, 76 insertions, 0 deletions
diff --git a/jack-tests/tests/com/android/jack/cast/CastTests.java b/jack-tests/tests/com/android/jack/cast/CastTests.java
index 6bccf9a1..74016987 100644
--- a/jack-tests/tests/com/android/jack/cast/CastTests.java
+++ b/jack-tests/tests/com/android/jack/cast/CastTests.java
@@ -35,6 +35,10 @@ public class CastTests extends RuntimeTest {
AbstractTestTools.getTestRootDir("com.android.jack.cast.explicit001"),
"com.android.jack.cast.explicit001.dx.Tests");
+ private RuntimeTestInfo EXPLICIT002 = new RuntimeTestInfo(
+ AbstractTestTools.getTestRootDir("com.android.jack.cast.explicit002"),
+ "com.android.jack.cast.explicit002.dx.Tests");
+
private RuntimeTestInfo IMPLICIT001 = new RuntimeTestInfo(
AbstractTestTools.getTestRootDir("com.android.jack.cast.implicit001"),
"com.android.jack.cast.implicit001.dx.Tests");
@@ -63,6 +67,7 @@ public class CastTests extends RuntimeTest {
public static void setUpClass() {
CastTests.class.getClassLoader().setDefaultAssertionStatus(true);
}
+
@Test
@Category(RuntimeRegressionTest.class)
public void explicit001() throws Exception {
@@ -71,6 +76,12 @@ public class CastTests extends RuntimeTest {
@Test
@Category(RuntimeRegressionTest.class)
+ public void explicit002() throws Exception {
+ new RuntimeTestHelper(EXPLICIT002).compileAndRunTest();
+ }
+
+ @Test
+ @Category(RuntimeRegressionTest.class)
public void implicit001() throws Exception {
new RuntimeTestHelper(IMPLICIT001).compileAndRunTest();
}
@@ -129,6 +140,7 @@ public class CastTests extends RuntimeTest {
@Override
protected void fillRtTestInfos() {
rtTestInfos.add(EXPLICIT001);
+ rtTestInfos.add(EXPLICIT002);
rtTestInfos.add(IMPLICIT001);
rtTestInfos.add(IMPLICIT002);
rtTestInfos.add(IMPLICIT003);
diff --git a/jack-tests/tests/com/android/jack/cast/explicit002/dx/Tests.java b/jack-tests/tests/com/android/jack/cast/explicit002/dx/Tests.java
new file mode 100644
index 00000000..4ce0161b
--- /dev/null
+++ b/jack-tests/tests/com/android/jack/cast/explicit002/dx/Tests.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.jack.cast.explicit002.dx;
+
+import com.android.jack.cast.explicit002.jack.Explicit002;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ * Tests about casting of null.
+ */
+public class Tests {
+
+ @Test
+ public void test1() {
+ try {
+ Explicit002.castWithNull();
+ Assert.fail();
+ } catch (NullPointerException e) {
+ }
+ }
+}
diff --git a/jack-tests/tests/com/android/jack/cast/explicit002/jack/Explicit002.java b/jack-tests/tests/com/android/jack/cast/explicit002/jack/Explicit002.java
new file mode 100644
index 00000000..b4ea00d7
--- /dev/null
+++ b/jack-tests/tests/com/android/jack/cast/explicit002/jack/Explicit002.java
@@ -0,0 +1,27 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.jack.cast.explicit002.jack;
+
+public class Explicit002 {
+
+ public static void castWithNull() {
+ useInt(((int[]) null)[0]);
+ }
+
+ public static void useInt(int i ) {
+ }
+}