summaryrefslogtreecommitdiffstats
path: root/jack-tests/tests/com/android/jack/conditional/test002
diff options
context:
space:
mode:
Diffstat (limited to 'jack-tests/tests/com/android/jack/conditional/test002')
-rw-r--r--jack-tests/tests/com/android/jack/conditional/test002/dx/Tests.java34
-rw-r--r--jack-tests/tests/com/android/jack/conditional/test002/jack/C.java21
-rw-r--r--jack-tests/tests/com/android/jack/conditional/test002/jack/C1.java21
-rw-r--r--jack-tests/tests/com/android/jack/conditional/test002/jack/C2.java21
-rw-r--r--jack-tests/tests/com/android/jack/conditional/test002/jack/Conditional2.java40
-rw-r--r--jack-tests/tests/com/android/jack/conditional/test002/jack/I1.java21
-rw-r--r--jack-tests/tests/com/android/jack/conditional/test002/jack/I2.java21
7 files changed, 179 insertions, 0 deletions
diff --git a/jack-tests/tests/com/android/jack/conditional/test002/dx/Tests.java b/jack-tests/tests/com/android/jack/conditional/test002/dx/Tests.java
new file mode 100644
index 0000000..b5d41cd
--- /dev/null
+++ b/jack-tests/tests/com/android/jack/conditional/test002/dx/Tests.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2012 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.conditional.test002.dx;
+
+import com.android.jack.conditional.test002.jack.Conditional2;
+
+import junit.framework.Assert;
+
+import org.junit.Test;
+
+public class Tests {
+
+ @Test
+ public void test1() {
+ Assert.assertEquals(1, Conditional2.test1(true));
+ Assert.assertEquals(2, Conditional2.test1(false));
+ Assert.assertEquals(2, Conditional2.test2(true));
+ Assert.assertEquals(0, Conditional2.test2(false));
+ }
+}
diff --git a/jack-tests/tests/com/android/jack/conditional/test002/jack/C.java b/jack-tests/tests/com/android/jack/conditional/test002/jack/C.java
new file mode 100644
index 0000000..2046e82
--- /dev/null
+++ b/jack-tests/tests/com/android/jack/conditional/test002/jack/C.java
@@ -0,0 +1,21 @@
+/*
+ * Copyright (C) 2012 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.conditional.test002.jack;
+
+public class C {
+
+}
diff --git a/jack-tests/tests/com/android/jack/conditional/test002/jack/C1.java b/jack-tests/tests/com/android/jack/conditional/test002/jack/C1.java
new file mode 100644
index 0000000..0829440
--- /dev/null
+++ b/jack-tests/tests/com/android/jack/conditional/test002/jack/C1.java
@@ -0,0 +1,21 @@
+/*
+ * Copyright (C) 2012 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.conditional.test002.jack;
+
+public class C1 extends C implements I1, I2 {
+
+}
diff --git a/jack-tests/tests/com/android/jack/conditional/test002/jack/C2.java b/jack-tests/tests/com/android/jack/conditional/test002/jack/C2.java
new file mode 100644
index 0000000..3f60f16
--- /dev/null
+++ b/jack-tests/tests/com/android/jack/conditional/test002/jack/C2.java
@@ -0,0 +1,21 @@
+/*
+ * Copyright (C) 2012 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.conditional.test002.jack;
+
+public class C2 extends C implements I1, I2 {
+
+}
diff --git a/jack-tests/tests/com/android/jack/conditional/test002/jack/Conditional2.java b/jack-tests/tests/com/android/jack/conditional/test002/jack/Conditional2.java
new file mode 100644
index 0000000..72e800b
--- /dev/null
+++ b/jack-tests/tests/com/android/jack/conditional/test002/jack/Conditional2.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2012 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.conditional.test002.jack;
+
+public class Conditional2 {
+ public static int test1(boolean cond) {
+ return m(cond ? new C1() : new C2());
+ }
+
+ private static int m(I1 i1) {
+ if (i1 instanceof C2) {
+ return 2;
+ } else if (i1 instanceof C1) {
+ return 1;
+ } else {
+ return 0;
+ }
+ }
+ public static int test2(boolean cond) {
+ return m2(cond ? new C1[2] : new C[0]);
+ }
+
+ private static int m2(C[] cs) {
+ return cs.length;
+ }
+}
diff --git a/jack-tests/tests/com/android/jack/conditional/test002/jack/I1.java b/jack-tests/tests/com/android/jack/conditional/test002/jack/I1.java
new file mode 100644
index 0000000..4d63321
--- /dev/null
+++ b/jack-tests/tests/com/android/jack/conditional/test002/jack/I1.java
@@ -0,0 +1,21 @@
+/*
+ * Copyright (C) 2012 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.conditional.test002.jack;
+
+public interface I1 {
+
+}
diff --git a/jack-tests/tests/com/android/jack/conditional/test002/jack/I2.java b/jack-tests/tests/com/android/jack/conditional/test002/jack/I2.java
new file mode 100644
index 0000000..2a357f4
--- /dev/null
+++ b/jack-tests/tests/com/android/jack/conditional/test002/jack/I2.java
@@ -0,0 +1,21 @@
+/*
+ * Copyright (C) 2012 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.conditional.test002.jack;
+
+public interface I2 {
+
+}