summaryrefslogtreecommitdiffstats
path: root/jack-tests/tests/com/android/jack/bridge
diff options
context:
space:
mode:
authorYohann Roussel <yroussel@google.com>2014-03-19 16:25:37 +0100
committerYohann Roussel <yroussel@google.com>2014-03-20 15:13:33 +0100
commit4eceb95409e844fdc33c9c706e1dc307bfd40303 (patch)
treeee9f4f3fc79f757c79081c336bce4f1782c6ccd8 /jack-tests/tests/com/android/jack/bridge
parent3d2402901b1a6462e2cf47a6fd09711f327961c3 (diff)
downloadtoolchain_jack-4eceb95409e844fdc33c9c706e1dc307bfd40303.zip
toolchain_jack-4eceb95409e844fdc33c9c706e1dc307bfd40303.tar.gz
toolchain_jack-4eceb95409e844fdc33c9c706e1dc307bfd40303.tar.bz2
Initial Jack import.
Change-Id: I953cf0a520195a7187d791b2885848ad0d5a9b43
Diffstat (limited to 'jack-tests/tests/com/android/jack/bridge')
-rw-r--r--jack-tests/tests/com/android/jack/bridge/test001/dx/Tests.java36
-rw-r--r--jack-tests/tests/com/android/jack/bridge/test001/jack/A.java28
-rw-r--r--jack-tests/tests/com/android/jack/bridge/test001/jack/B.java28
-rw-r--r--jack-tests/tests/com/android/jack/bridge/test002/dx/Tests.java28
-rw-r--r--jack-tests/tests/com/android/jack/bridge/test002/dx/TestsWithDx.java73
-rw-r--r--jack-tests/tests/com/android/jack/bridge/test002/jack/A.java23
-rw-r--r--jack-tests/tests/com/android/jack/bridge/test002/jack/B.java23
-rw-r--r--jack-tests/tests/com/android/jack/bridge/test002/jack/C.java33
-rw-r--r--jack-tests/tests/com/android/jack/bridge/test002/jack/Generic.java33
-rw-r--r--jack-tests/tests/com/android/jack/bridge/test002/jack/TestsWithJack.java66
-rw-r--r--jack-tests/tests/com/android/jack/bridge/test003/dx/Tests.java55
-rw-r--r--jack-tests/tests/com/android/jack/bridge/test003/jack/Data.java60
-rw-r--r--jack-tests/tests/com/android/jack/bridge/test004/dx/Tests.java36
-rw-r--r--jack-tests/tests/com/android/jack/bridge/test004/jack/Data.java38
-rw-r--r--jack-tests/tests/com/android/jack/bridge/test005/dx/Tests.java45
-rw-r--r--jack-tests/tests/com/android/jack/bridge/test005/jack/Data.java41
-rw-r--r--jack-tests/tests/com/android/jack/bridge/test006/dx/Tests.java37
-rw-r--r--jack-tests/tests/com/android/jack/bridge/test006/jack/Data.java52
-rw-r--r--jack-tests/tests/com/android/jack/bridge/test007/dx/Tests.java29
-rw-r--r--jack-tests/tests/com/android/jack/bridge/test007/jack/Caller.java26
-rw-r--r--jack-tests/tests/com/android/jack/bridge/test007/jack/sub/GenericPackageProtected.java25
-rw-r--r--jack-tests/tests/com/android/jack/bridge/test007/jack/sub/PublicExtendsGeneric.java21
22 files changed, 836 insertions, 0 deletions
diff --git a/jack-tests/tests/com/android/jack/bridge/test001/dx/Tests.java b/jack-tests/tests/com/android/jack/bridge/test001/dx/Tests.java
new file mode 100644
index 0000000..1bdd805
--- /dev/null
+++ b/jack-tests/tests/com/android/jack/bridge/test001/dx/Tests.java
@@ -0,0 +1,36 @@
+/*
+ * 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.bridge.test001.dx;
+
+import com.android.jack.bridge.test001.jack.A;
+import com.android.jack.bridge.test001.jack.B;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+public class Tests {
+
+ @Test
+ public void test1() {
+ A a = new A();
+ B b = new B();
+ A b2 = new B();
+ Assert.assertEquals(a, a.get());
+ Assert.assertEquals(b, b.get());
+ Assert.assertEquals(b2, b2.get());
+ }
+}
diff --git a/jack-tests/tests/com/android/jack/bridge/test001/jack/A.java b/jack-tests/tests/com/android/jack/bridge/test001/jack/A.java
new file mode 100644
index 0000000..74e2ab4
--- /dev/null
+++ b/jack-tests/tests/com/android/jack/bridge/test001/jack/A.java
@@ -0,0 +1,28 @@
+/*
+ * 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.bridge.test001.jack;
+
+public class A {
+
+ public A() {
+ }
+
+ public A get() {
+ return this;
+ }
+
+}
diff --git a/jack-tests/tests/com/android/jack/bridge/test001/jack/B.java b/jack-tests/tests/com/android/jack/bridge/test001/jack/B.java
new file mode 100644
index 0000000..51028d7
--- /dev/null
+++ b/jack-tests/tests/com/android/jack/bridge/test001/jack/B.java
@@ -0,0 +1,28 @@
+/*
+ * 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.bridge.test001.jack;
+
+public class B extends A {
+
+ public B() {
+ }
+
+ @Override
+ public B get() {
+ return this;
+ }
+}
diff --git a/jack-tests/tests/com/android/jack/bridge/test002/dx/Tests.java b/jack-tests/tests/com/android/jack/bridge/test002/dx/Tests.java
new file mode 100644
index 0000000..1a018ff
--- /dev/null
+++ b/jack-tests/tests/com/android/jack/bridge/test002/dx/Tests.java
@@ -0,0 +1,28 @@
+/*
+ * 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.bridge.test002.dx;
+
+import com.android.jack.bridge.test002.jack.TestsWithJack;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+import org.junit.runners.Suite.SuiteClasses;
+
+@RunWith(Suite.class)
+@SuiteClasses(value = {TestsWithDx.class, TestsWithJack.class})
+public class Tests {
+} \ No newline at end of file
diff --git a/jack-tests/tests/com/android/jack/bridge/test002/dx/TestsWithDx.java b/jack-tests/tests/com/android/jack/bridge/test002/dx/TestsWithDx.java
new file mode 100644
index 0000000..9fc0e68
--- /dev/null
+++ b/jack-tests/tests/com/android/jack/bridge/test002/dx/TestsWithDx.java
@@ -0,0 +1,73 @@
+/*
+ * 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.bridge.test002.dx;
+
+import com.android.jack.bridge.test002.jack.A;
+import com.android.jack.bridge.test002.jack.B;
+import com.android.jack.bridge.test002.jack.C;
+import com.android.jack.bridge.test002.jack.Generic;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+public class TestsWithDx {
+ private A a = new A();
+ private Object a2 = new A();
+ private Object o = new Object();
+ private B b = new B();
+ private Generic b2 = new B();
+ private C c = new C();
+ private Generic c2 = new C();
+ private Generic<Object> go = new Generic<Object>();
+ private Generic gb = new Generic<B>();
+
+ @Test
+ public void test1() {
+ b.setT(a);
+ Assert.assertEquals(a, b.getT());
+ b2.setT(a2);
+ Assert.assertEquals(a2, b2.getT());
+ c.setT(a);
+ Assert.assertEquals(a, c.getT());
+ c2.setT(a2);
+ Assert.assertEquals(a2, c2.getT());
+ go.setT(a);
+ Assert.assertEquals(a, go.getT());
+ go.setT(o);
+ Assert.assertEquals(o, go.getT());
+ gb.setT(b);
+ Assert.assertEquals(b, gb.getT());
+ gb.setT(o);
+ Assert.assertEquals(o, gb.getT());
+ }
+
+ @Test
+ public void test2() {
+ b2.setT(o);
+ Assert.assertEquals(o, b2.getT());
+ }
+
+ @Test
+ public void test3() {
+ try {
+ c2.setT(o);
+ Assert.fail();
+ } catch (ClassCastException e) {
+ // expected
+ }
+ }
+}
diff --git a/jack-tests/tests/com/android/jack/bridge/test002/jack/A.java b/jack-tests/tests/com/android/jack/bridge/test002/jack/A.java
new file mode 100644
index 0000000..f60dac8
--- /dev/null
+++ b/jack-tests/tests/com/android/jack/bridge/test002/jack/A.java
@@ -0,0 +1,23 @@
+/*
+ * 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.bridge.test002.jack;
+
+public class A {
+
+ public A() {
+ }
+}
diff --git a/jack-tests/tests/com/android/jack/bridge/test002/jack/B.java b/jack-tests/tests/com/android/jack/bridge/test002/jack/B.java
new file mode 100644
index 0000000..f1c539e
--- /dev/null
+++ b/jack-tests/tests/com/android/jack/bridge/test002/jack/B.java
@@ -0,0 +1,23 @@
+/*
+ * 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.bridge.test002.jack;
+
+public class B extends Generic<A> {
+
+ public B() {
+ }
+}
diff --git a/jack-tests/tests/com/android/jack/bridge/test002/jack/C.java b/jack-tests/tests/com/android/jack/bridge/test002/jack/C.java
new file mode 100644
index 0000000..6bd1607
--- /dev/null
+++ b/jack-tests/tests/com/android/jack/bridge/test002/jack/C.java
@@ -0,0 +1,33 @@
+/*
+ * 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.bridge.test002.jack;
+
+public class C extends Generic<A> {
+
+ public C() {
+ }
+
+ @Override
+ public A getT() {
+ return super.getT();
+ }
+
+ @Override
+ public void setT(A t) {
+ super.setT(t);
+ }
+}
diff --git a/jack-tests/tests/com/android/jack/bridge/test002/jack/Generic.java b/jack-tests/tests/com/android/jack/bridge/test002/jack/Generic.java
new file mode 100644
index 0000000..d684824
--- /dev/null
+++ b/jack-tests/tests/com/android/jack/bridge/test002/jack/Generic.java
@@ -0,0 +1,33 @@
+/*
+ * 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.bridge.test002.jack;
+
+public class Generic<T> {
+
+ private T t;
+
+ public Generic() {
+ }
+
+ public void setT(T t) {
+ this.t = t;
+ }
+
+ public T getT() {
+ return t;
+ }
+}
diff --git a/jack-tests/tests/com/android/jack/bridge/test002/jack/TestsWithJack.java b/jack-tests/tests/com/android/jack/bridge/test002/jack/TestsWithJack.java
new file mode 100644
index 0000000..9843479
--- /dev/null
+++ b/jack-tests/tests/com/android/jack/bridge/test002/jack/TestsWithJack.java
@@ -0,0 +1,66 @@
+/*
+ * 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.bridge.test002.jack;
+
+import junit.framework.TestCase;
+
+import org.junit.Assert;
+
+public class TestsWithJack extends TestCase {
+ private A a = new A();
+ private Object a2 = new A();
+ private Object o = new Object();
+ private B b = new B();
+ private Generic b2 = new B();
+ private C c = new C();
+ private Generic c2 = new C();
+ private Generic<Object> go = new Generic<Object>();
+ private Generic gb = new Generic<B>();
+
+ public void test1() {
+ b.setT(a);
+ Assert.assertEquals(a, b.getT());
+ b2.setT(a2);
+ Assert.assertEquals(a2, b2.getT());
+ c.setT(a);
+ Assert.assertEquals(a, c.getT());
+ c2.setT(a2);
+ Assert.assertEquals(a2, c2.getT());
+ go.setT(a);
+ Assert.assertEquals(a, go.getT());
+ go.setT(o);
+ Assert.assertEquals(o, go.getT());
+ gb.setT(b);
+ Assert.assertEquals(b, gb.getT());
+ gb.setT(o);
+ Assert.assertEquals(o, gb.getT());
+ }
+
+ public void test2() {
+ b2.setT(o);
+ Assert.assertEquals(o, b2.getT());
+ }
+
+ public void test3() {
+ try {
+ c2.setT(o);
+ Assert.fail();
+ } catch (ClassCastException e) {
+ // expected
+ }
+ }
+}
diff --git a/jack-tests/tests/com/android/jack/bridge/test003/dx/Tests.java b/jack-tests/tests/com/android/jack/bridge/test003/dx/Tests.java
new file mode 100644
index 0000000..f6b7c61
--- /dev/null
+++ b/jack-tests/tests/com/android/jack/bridge/test003/dx/Tests.java
@@ -0,0 +1,55 @@
+/*
+ * 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.bridge.test003.dx;
+
+import com.android.jack.bridge.test003.jack.Data;
+import com.android.jack.bridge.test003.jack.Data.B;
+
+import junit.framework.Assert;
+
+import org.junit.Test;
+
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+
+public class Tests {
+ @Test
+ public void test001() throws Exception {
+ Data data = new Data();
+ Method method = data.getMethod1();
+ Assert.assertEquals(B.class, method.getDeclaringClass());
+ Assert.assertTrue(method.isSynthetic());
+ Assert.assertTrue(method.isBridge());
+ data.getMethod2();
+
+ Data.B b = new B();
+ b.unchanged();
+ b.unchangedFinal();
+ }
+
+ @Test
+ public void test003() throws Exception {
+ Data data = new Data();
+ Method method = data.getMethod3();
+ Assert.assertEquals(B.class, method.getDeclaringClass());
+ Assert.assertTrue(method.isSynthetic());
+ Assert.assertTrue(method.isBridge());
+ Assert.assertFalse(Modifier.isSynchronized(method.getModifiers()));
+ Data.B b = new B();
+ b.unchangedSynchronized();
+ }
+}
diff --git a/jack-tests/tests/com/android/jack/bridge/test003/jack/Data.java b/jack-tests/tests/com/android/jack/bridge/test003/jack/Data.java
new file mode 100644
index 0000000..3363a02
--- /dev/null
+++ b/jack-tests/tests/com/android/jack/bridge/test003/jack/Data.java
@@ -0,0 +1,60 @@
+/*
+ * 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.bridge.test003.jack;
+
+import java.lang.reflect.Method;
+
+public class Data {
+
+ static class A {
+ public void unchanged() {}
+ public final void unchangedFinal() {}
+ public synchronized void unchangedSynchronized() {}
+ }
+
+ public static class B extends A {}
+
+ public Method getMethod1() {
+ Method[] methods = B.class.getMethods();
+ for (Method method : methods) {
+ if (method.getName().equals("unchanged")) {
+ return method;
+ }
+ }
+ return null;
+ }
+
+ public Method getMethod2() {
+ Method[] methods = B.class.getMethods();
+ for (Method method : methods) {
+ if (method.getName().equals("unchangedFinal")) {
+ return method;
+ }
+ }
+ return null;
+ }
+
+ public Method getMethod3() {
+ Method[] methods = B.class.getMethods();
+ for (Method method : methods) {
+ if (method.getName().equals("unchangedSynchronized")) {
+ return method;
+ }
+ }
+ return null;
+ }
+}
diff --git a/jack-tests/tests/com/android/jack/bridge/test004/dx/Tests.java b/jack-tests/tests/com/android/jack/bridge/test004/dx/Tests.java
new file mode 100644
index 0000000..93ba72c
--- /dev/null
+++ b/jack-tests/tests/com/android/jack/bridge/test004/dx/Tests.java
@@ -0,0 +1,36 @@
+/*
+ * 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.bridge.test004.dx;
+
+import com.android.jack.bridge.test004.jack.Data;
+import com.android.jack.bridge.test004.jack.Data.B;
+
+import junit.framework.Assert;
+
+import org.junit.Test;
+
+import java.lang.reflect.Method;
+
+public class Tests {
+ @Test
+ public void test001() throws Exception {
+ Method method = new Data().getMethod();
+ Assert.assertNotSame(B.class, new Data().getMethod().getDeclaringClass());
+ Assert.assertFalse(method.isSynthetic());
+ Assert.assertFalse(method.isBridge());
+ }
+}
diff --git a/jack-tests/tests/com/android/jack/bridge/test004/jack/Data.java b/jack-tests/tests/com/android/jack/bridge/test004/jack/Data.java
new file mode 100644
index 0000000..521876d
--- /dev/null
+++ b/jack-tests/tests/com/android/jack/bridge/test004/jack/Data.java
@@ -0,0 +1,38 @@
+/*
+ * 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.bridge.test004.jack;
+
+import java.lang.reflect.Method;
+
+public class Data {
+
+ static class A {
+ public static void unchanged() {}
+ }
+
+ public static class B extends A {}
+
+ public static Method getMethod() {
+ Method[] methods = B.class.getMethods();
+ for (Method method : methods) {
+ if (method.getName().equals("unchanged")) {
+ return method;
+ }
+ }
+ return null;
+ }
+}
diff --git a/jack-tests/tests/com/android/jack/bridge/test005/dx/Tests.java b/jack-tests/tests/com/android/jack/bridge/test005/dx/Tests.java
new file mode 100644
index 0000000..e6df068
--- /dev/null
+++ b/jack-tests/tests/com/android/jack/bridge/test005/dx/Tests.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2013 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.bridge.test005.dx;
+
+import com.android.jack.bridge.test005.jack.Data;
+import com.android.jack.bridge.test005.jack.Data.B;
+
+import junit.framework.Assert;
+
+import org.junit.Test;
+
+import java.lang.reflect.Method;
+
+public class Tests {
+
+ /**
+ * Test that a visibility bridge is created in B, but not in C. It would not be incorrect, but
+ * unnecessary.
+ */
+ @Test
+ public void test001() throws Exception {
+ Data data = new Data();
+ Method method = data.getMethod1();
+ Assert.assertEquals(B.class, method.getDeclaringClass());
+ Assert.assertTrue(method.isSynthetic());
+ Assert.assertTrue(method.isBridge());
+
+ Data.B b = new B();
+ b.unchanged();
+ }
+}
diff --git a/jack-tests/tests/com/android/jack/bridge/test005/jack/Data.java b/jack-tests/tests/com/android/jack/bridge/test005/jack/Data.java
new file mode 100644
index 0000000..2998ef3
--- /dev/null
+++ b/jack-tests/tests/com/android/jack/bridge/test005/jack/Data.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2013 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.bridge.test005.jack;
+
+import java.lang.reflect.Method;
+
+public class Data {
+
+ static class A {
+ public void unchanged() {}
+ }
+
+ public static class C extends B {}
+
+ public static class B extends A {}
+
+
+ public Method getMethod1() {
+ Method[] methods = C.class.getMethods();
+ for (Method method : methods) {
+ if (method.getName().equals("unchanged")) {
+ return method;
+ }
+ }
+ return null;
+ }
+}
diff --git a/jack-tests/tests/com/android/jack/bridge/test006/dx/Tests.java b/jack-tests/tests/com/android/jack/bridge/test006/dx/Tests.java
new file mode 100644
index 0000000..5ba3fa9
--- /dev/null
+++ b/jack-tests/tests/com/android/jack/bridge/test006/dx/Tests.java
@@ -0,0 +1,37 @@
+/*
+ * 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.bridge.test006.dx;
+
+import com.android.jack.bridge.test006.jack.Data;
+import com.android.jack.bridge.test006.jack.Data.C;
+
+import junit.framework.Assert;
+
+import org.junit.Test;
+
+import java.lang.reflect.Method;
+
+public class Tests {
+ @Test
+ public void test001() throws Exception {
+ Data data = new Data();
+ Method method = data.getMethod1();
+ Assert.assertEquals(C.class, method.getDeclaringClass());
+ Assert.assertTrue(method.isSynthetic());
+ Assert.assertTrue(method.isBridge());
+ }
+}
diff --git a/jack-tests/tests/com/android/jack/bridge/test006/jack/Data.java b/jack-tests/tests/com/android/jack/bridge/test006/jack/Data.java
new file mode 100644
index 0000000..4c5839f
--- /dev/null
+++ b/jack-tests/tests/com/android/jack/bridge/test006/jack/Data.java
@@ -0,0 +1,52 @@
+/*
+ * 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.bridge.test006.jack;
+
+import java.lang.reflect.Method;
+
+public class Data {
+
+ static class A {
+ public Object unchanged() {
+ return this;
+ }
+ }
+
+ static class B extends A {
+ @Override
+ public B unchanged() {
+ return this;
+ }
+ }
+
+ public static class C extends B {
+ @Override
+ public C unchanged() {
+ return this;
+ }
+ }
+
+ public Method getMethod1() {
+ Method[] methods = C.class.getMethods();
+ for (Method method : methods) {
+ if (method.getName().equals("unchanged") && method.getReturnType().equals(Object.class)) {
+ return method;
+ }
+ }
+ return null;
+ }
+}
diff --git a/jack-tests/tests/com/android/jack/bridge/test007/dx/Tests.java b/jack-tests/tests/com/android/jack/bridge/test007/dx/Tests.java
new file mode 100644
index 0000000..693ede0
--- /dev/null
+++ b/jack-tests/tests/com/android/jack/bridge/test007/dx/Tests.java
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2014 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.bridge.test007.dx;
+
+import com.android.jack.bridge.test007.jack.Caller;
+
+import org.junit.Test;
+
+public class Tests {
+
+ @Test
+ public void test1() {
+ new Caller().add(Integer.valueOf(0));
+ }
+}
diff --git a/jack-tests/tests/com/android/jack/bridge/test007/jack/Caller.java b/jack-tests/tests/com/android/jack/bridge/test007/jack/Caller.java
new file mode 100644
index 0000000..987ab55
--- /dev/null
+++ b/jack-tests/tests/com/android/jack/bridge/test007/jack/Caller.java
@@ -0,0 +1,26 @@
+/*
+ * Copyright (C) 2014 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.bridge.test007.jack;
+
+import com.android.jack.bridge.test007.jack.sub.PublicExtendsGeneric;
+
+public class Caller {
+
+ public void add(Integer start) {
+ new PublicExtendsGeneric<Integer>().put(start);
+ }
+}
diff --git a/jack-tests/tests/com/android/jack/bridge/test007/jack/sub/GenericPackageProtected.java b/jack-tests/tests/com/android/jack/bridge/test007/jack/sub/GenericPackageProtected.java
new file mode 100644
index 0000000..8844d52
--- /dev/null
+++ b/jack-tests/tests/com/android/jack/bridge/test007/jack/sub/GenericPackageProtected.java
@@ -0,0 +1,25 @@
+/*
+ * Copyright (C) 2014 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.bridge.test007.jack.sub;
+
+
+class GenericPackageProtected<T> {
+
+ public void put(T key) {
+ }
+}
+
diff --git a/jack-tests/tests/com/android/jack/bridge/test007/jack/sub/PublicExtendsGeneric.java b/jack-tests/tests/com/android/jack/bridge/test007/jack/sub/PublicExtendsGeneric.java
new file mode 100644
index 0000000..bd520a9
--- /dev/null
+++ b/jack-tests/tests/com/android/jack/bridge/test007/jack/sub/PublicExtendsGeneric.java
@@ -0,0 +1,21 @@
+/*
+ * Copyright (C) 2014 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.bridge.test007.jack.sub;
+
+
+public class PublicExtendsGeneric<T> extends GenericPackageProtected<T> {
+}