summaryrefslogtreecommitdiffstats
path: root/jack-tests/tests/com/android/jack/shrob/test011
diff options
context:
space:
mode:
Diffstat (limited to 'jack-tests/tests/com/android/jack/shrob/test011')
-rw-r--r--jack-tests/tests/com/android/jack/shrob/test011/dx/Tests.java34
-rw-r--r--jack-tests/tests/com/android/jack/shrob/test011/dx/Tests2.java34
-rw-r--r--jack-tests/tests/com/android/jack/shrob/test011/jack/A.java44
-rw-r--r--jack-tests/tests/com/android/jack/shrob/test011/jack/B.java23
-rw-r--r--jack-tests/tests/com/android/jack/shrob/test011/jack/C.java21
-rw-r--r--jack-tests/tests/com/android/jack/shrob/test011/proguard.flags0013
-rw-r--r--jack-tests/tests/com/android/jack/shrob/test011/proguard.flags001.mapping3
-rw-r--r--jack-tests/tests/com/android/jack/shrob/test011/proguard.flags0023
-rw-r--r--jack-tests/tests/com/android/jack/shrob/test011/proguard.flags002.mapping4
-rw-r--r--jack-tests/tests/com/android/jack/shrob/test011/refsFlattenPackage/expected-001.txt7
-rw-r--r--jack-tests/tests/com/android/jack/shrob/test011/refsFlattenPackage/expected-002.txt6
-rw-r--r--jack-tests/tests/com/android/jack/shrob/test011/refsObfuscationWithMapping/expected-001.txt7
-rw-r--r--jack-tests/tests/com/android/jack/shrob/test011/refsObfuscationWithMapping/expected-002.txt6
-rw-r--r--jack-tests/tests/com/android/jack/shrob/test011/refsObfuscationWithoutMapping/expected-001.txt7
-rw-r--r--jack-tests/tests/com/android/jack/shrob/test011/refsObfuscationWithoutMapping/expected-002.txt6
-rw-r--r--jack-tests/tests/com/android/jack/shrob/test011/refsRepackageClasses/expected-001.txt7
-rw-r--r--jack-tests/tests/com/android/jack/shrob/test011/refsRepackageClasses/expected-002.txt6
-rw-r--r--jack-tests/tests/com/android/jack/shrob/test011/refsSeed/expected-001.txt2
-rw-r--r--jack-tests/tests/com/android/jack/shrob/test011/refsSeed/expected-002.txt2
-rw-r--r--jack-tests/tests/com/android/jack/shrob/test011/refsShrinking/expected-001.txt7
-rw-r--r--jack-tests/tests/com/android/jack/shrob/test011/refsShrinking/expected-002.txt6
-rw-r--r--jack-tests/tests/com/android/jack/shrob/test011/test.mk25
-rw-r--r--jack-tests/tests/com/android/jack/shrob/test011/test2.mk25
23 files changed, 288 insertions, 0 deletions
diff --git a/jack-tests/tests/com/android/jack/shrob/test011/dx/Tests.java b/jack-tests/tests/com/android/jack/shrob/test011/dx/Tests.java
new file mode 100644
index 0000000..4241948
--- /dev/null
+++ b/jack-tests/tests/com/android/jack/shrob/test011/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.shrob.test011.dx;
+
+import com.android.jack.shrob.test011.jack.A;
+import com.android.jack.shrob.test011.jack.B;
+
+import org.junit.Assert;
+import org.junit.Ignore;
+import org.junit.Test;
+
+public class Tests {
+
+ @Test
+ @Ignore("Bug 10795183")
+ public void test() throws ClassNotFoundException, IllegalAccessException,
+ IllegalArgumentException, SecurityException, InstantiationException {
+ Assert.assertEquals(B.class, A.keep1().getClass());
+ }
+}
diff --git a/jack-tests/tests/com/android/jack/shrob/test011/dx/Tests2.java b/jack-tests/tests/com/android/jack/shrob/test011/dx/Tests2.java
new file mode 100644
index 0000000..716cd9b
--- /dev/null
+++ b/jack-tests/tests/com/android/jack/shrob/test011/dx/Tests2.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.shrob.test011.dx;
+
+import com.android.jack.shrob.test011.jack.A;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+import java.lang.reflect.InvocationTargetException;
+
+public class Tests2 {
+
+ @Test
+ public void test() throws IllegalAccessException,
+ IllegalArgumentException, SecurityException, InstantiationException, InvocationTargetException,
+ NoSuchMethodException {
+ Assert.assertEquals(42, A.keep2());
+ }
+}
diff --git a/jack-tests/tests/com/android/jack/shrob/test011/jack/A.java b/jack-tests/tests/com/android/jack/shrob/test011/jack/A.java
new file mode 100644
index 0000000..c424112
--- /dev/null
+++ b/jack-tests/tests/com/android/jack/shrob/test011/jack/A.java
@@ -0,0 +1,44 @@
+/*
+ * 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.shrob.test011.jack;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
+public class A {
+ public static Object keep1() throws ClassNotFoundException, IllegalAccessException, IllegalArgumentException,
+ SecurityException, InstantiationException {
+ Class<?> bClass = Class.forName("com.android.jack.shrob.test011.jack.B");
+ Object o = bClass.newInstance();
+
+ try {
+ String cName = "com.android.jack.shrob.test011.jack.C";
+ Class<?> cClass = Class.forName(cName);
+ throw new RuntimeException();
+ } catch (ClassNotFoundException e) {
+ // expected (used to verify the code has been shrunk)
+ }
+ return o;
+ }
+
+ public static int keep2() throws IllegalAccessException, IllegalArgumentException,
+ InvocationTargetException, NoSuchMethodException, SecurityException, InstantiationException {
+ Object o = B.class.newInstance();
+ Method m = B.class.getMethod("value");
+ return ((Integer) m.invoke(o, (Object[]) null)).intValue();
+ }
+}
diff --git a/jack-tests/tests/com/android/jack/shrob/test011/jack/B.java b/jack-tests/tests/com/android/jack/shrob/test011/jack/B.java
new file mode 100644
index 0000000..8cf561d
--- /dev/null
+++ b/jack-tests/tests/com/android/jack/shrob/test011/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.shrob.test011.jack;
+
+public class B {
+ public int value() {
+ return 42;
+ }
+}
diff --git a/jack-tests/tests/com/android/jack/shrob/test011/jack/C.java b/jack-tests/tests/com/android/jack/shrob/test011/jack/C.java
new file mode 100644
index 0000000..173c6a8
--- /dev/null
+++ b/jack-tests/tests/com/android/jack/shrob/test011/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.shrob.test011.jack;
+
+public class C {
+
+}
diff --git a/jack-tests/tests/com/android/jack/shrob/test011/proguard.flags001 b/jack-tests/tests/com/android/jack/shrob/test011/proguard.flags001
new file mode 100644
index 0000000..1788d45
--- /dev/null
+++ b/jack-tests/tests/com/android/jack/shrob/test011/proguard.flags001
@@ -0,0 +1,3 @@
+-keep class com.android.jack.shrob.test011.jack.A {
+ java.lang.Object keep1();
+} \ No newline at end of file
diff --git a/jack-tests/tests/com/android/jack/shrob/test011/proguard.flags001.mapping b/jack-tests/tests/com/android/jack/shrob/test011/proguard.flags001.mapping
new file mode 100644
index 0000000..20cd8cd
--- /dev/null
+++ b/jack-tests/tests/com/android/jack/shrob/test011/proguard.flags001.mapping
@@ -0,0 +1,3 @@
+com.android.jack.shrob.test011.jack.A -> com.android.jack.shrob.test011.jack.A:
+ java.lang.Object keep1() -> keep1
+com.android.jack.shrob.test011.jack.B -> com.android.jack.shrob.test011.jack.a:
diff --git a/jack-tests/tests/com/android/jack/shrob/test011/proguard.flags002 b/jack-tests/tests/com/android/jack/shrob/test011/proguard.flags002
new file mode 100644
index 0000000..71b1bc5
--- /dev/null
+++ b/jack-tests/tests/com/android/jack/shrob/test011/proguard.flags002
@@ -0,0 +1,3 @@
+-keep class com.android.jack.shrob.test011.jack.A {
+ % keep2();
+} \ No newline at end of file
diff --git a/jack-tests/tests/com/android/jack/shrob/test011/proguard.flags002.mapping b/jack-tests/tests/com/android/jack/shrob/test011/proguard.flags002.mapping
new file mode 100644
index 0000000..b4d6638
--- /dev/null
+++ b/jack-tests/tests/com/android/jack/shrob/test011/proguard.flags002.mapping
@@ -0,0 +1,4 @@
+com.android.jack.shrob.test011.jack.A -> com.android.jack.shrob.test011.jack.A:
+ int keep2() -> keep2
+com.android.jack.shrob.test011.jack.B -> com.android.jack.shrob.test011.jack.a:
+ int value() -> a
diff --git a/jack-tests/tests/com/android/jack/shrob/test011/refsFlattenPackage/expected-001.txt b/jack-tests/tests/com/android/jack/shrob/test011/refsFlattenPackage/expected-001.txt
new file mode 100644
index 0000000..1885020
--- /dev/null
+++ b/jack-tests/tests/com/android/jack/shrob/test011/refsFlattenPackage/expected-001.txt
@@ -0,0 +1,7 @@
+com.android.jack.shrob.test011.jack.B -> com.android.jack.shrob.test011.jack.O:
+ void <init>() -> <init>
+com.android.jack.shrob.test011.jack.C -> com.android.jack.shrob.test011.jack.P:
+ void <init>() -> <init>
+com.android.jack.shrob.test011.jack.A -> com.android.jack.shrob.test011.jack.A:
+ void <init>() -> <init>
+ java.lang.Object keep1() -> keep1
diff --git a/jack-tests/tests/com/android/jack/shrob/test011/refsFlattenPackage/expected-002.txt b/jack-tests/tests/com/android/jack/shrob/test011/refsFlattenPackage/expected-002.txt
new file mode 100644
index 0000000..5c78b00
--- /dev/null
+++ b/jack-tests/tests/com/android/jack/shrob/test011/refsFlattenPackage/expected-002.txt
@@ -0,0 +1,6 @@
+com.android.jack.shrob.test011.jack.B -> com.android.jack.shrob.test011.jack.O:
+ void <init>() -> <init>
+ int value() -> jnyir__
+com.android.jack.shrob.test011.jack.A -> com.android.jack.shrob.test011.jack.A:
+ void <init>() -> <init>
+ int keep2() -> keep2
diff --git a/jack-tests/tests/com/android/jack/shrob/test011/refsObfuscationWithMapping/expected-001.txt b/jack-tests/tests/com/android/jack/shrob/test011/refsObfuscationWithMapping/expected-001.txt
new file mode 100644
index 0000000..4b930bf
--- /dev/null
+++ b/jack-tests/tests/com/android/jack/shrob/test011/refsObfuscationWithMapping/expected-001.txt
@@ -0,0 +1,7 @@
+com.android.jack.shrob.test011.jack.B -> com.android.jack.shrob.test011.jack.a:
+ void <init>() -> <init>
+com.android.jack.shrob.test011.jack.C -> com.android.jack.shrob.test011.jack.b:
+ void <init>() -> <init>
+com.android.jack.shrob.test011.jack.A -> com.android.jack.shrob.test011.jack.A:
+ void <init>() -> <init>
+ java.lang.Object keep1() -> keep1
diff --git a/jack-tests/tests/com/android/jack/shrob/test011/refsObfuscationWithMapping/expected-002.txt b/jack-tests/tests/com/android/jack/shrob/test011/refsObfuscationWithMapping/expected-002.txt
new file mode 100644
index 0000000..a1dd7bc
--- /dev/null
+++ b/jack-tests/tests/com/android/jack/shrob/test011/refsObfuscationWithMapping/expected-002.txt
@@ -0,0 +1,6 @@
+com.android.jack.shrob.test011.jack.B -> com.android.jack.shrob.test011.jack.a:
+ void <init>() -> <init>
+ int value() -> a
+com.android.jack.shrob.test011.jack.A -> com.android.jack.shrob.test011.jack.A:
+ void <init>() -> <init>
+ int keep2() -> keep2
diff --git a/jack-tests/tests/com/android/jack/shrob/test011/refsObfuscationWithoutMapping/expected-001.txt b/jack-tests/tests/com/android/jack/shrob/test011/refsObfuscationWithoutMapping/expected-001.txt
new file mode 100644
index 0000000..1885020
--- /dev/null
+++ b/jack-tests/tests/com/android/jack/shrob/test011/refsObfuscationWithoutMapping/expected-001.txt
@@ -0,0 +1,7 @@
+com.android.jack.shrob.test011.jack.B -> com.android.jack.shrob.test011.jack.O:
+ void <init>() -> <init>
+com.android.jack.shrob.test011.jack.C -> com.android.jack.shrob.test011.jack.P:
+ void <init>() -> <init>
+com.android.jack.shrob.test011.jack.A -> com.android.jack.shrob.test011.jack.A:
+ void <init>() -> <init>
+ java.lang.Object keep1() -> keep1
diff --git a/jack-tests/tests/com/android/jack/shrob/test011/refsObfuscationWithoutMapping/expected-002.txt b/jack-tests/tests/com/android/jack/shrob/test011/refsObfuscationWithoutMapping/expected-002.txt
new file mode 100644
index 0000000..5c78b00
--- /dev/null
+++ b/jack-tests/tests/com/android/jack/shrob/test011/refsObfuscationWithoutMapping/expected-002.txt
@@ -0,0 +1,6 @@
+com.android.jack.shrob.test011.jack.B -> com.android.jack.shrob.test011.jack.O:
+ void <init>() -> <init>
+ int value() -> jnyir__
+com.android.jack.shrob.test011.jack.A -> com.android.jack.shrob.test011.jack.A:
+ void <init>() -> <init>
+ int keep2() -> keep2
diff --git a/jack-tests/tests/com/android/jack/shrob/test011/refsRepackageClasses/expected-001.txt b/jack-tests/tests/com/android/jack/shrob/test011/refsRepackageClasses/expected-001.txt
new file mode 100644
index 0000000..1271673
--- /dev/null
+++ b/jack-tests/tests/com/android/jack/shrob/test011/refsRepackageClasses/expected-001.txt
@@ -0,0 +1,7 @@
+com.android.jack.shrob.test011.jack.A -> com.android.jack.shrob.test011.jack.A:
+ void <init>() -> <init>
+ java.lang.Object keep1() -> keep1
+com.android.jack.shrob.test011.jack.B -> O:
+ void <init>() -> <init>
+com.android.jack.shrob.test011.jack.C -> P:
+ void <init>() -> <init>
diff --git a/jack-tests/tests/com/android/jack/shrob/test011/refsRepackageClasses/expected-002.txt b/jack-tests/tests/com/android/jack/shrob/test011/refsRepackageClasses/expected-002.txt
new file mode 100644
index 0000000..cdf7852
--- /dev/null
+++ b/jack-tests/tests/com/android/jack/shrob/test011/refsRepackageClasses/expected-002.txt
@@ -0,0 +1,6 @@
+com.android.jack.shrob.test011.jack.A -> com.android.jack.shrob.test011.jack.A:
+ void <init>() -> <init>
+ int keep2() -> keep2
+com.android.jack.shrob.test011.jack.B -> O:
+ void <init>() -> <init>
+ int value() -> jnyir__
diff --git a/jack-tests/tests/com/android/jack/shrob/test011/refsSeed/expected-001.txt b/jack-tests/tests/com/android/jack/shrob/test011/refsSeed/expected-001.txt
new file mode 100644
index 0000000..5054890
--- /dev/null
+++ b/jack-tests/tests/com/android/jack/shrob/test011/refsSeed/expected-001.txt
@@ -0,0 +1,2 @@
+com.android.jack.shrob.test011.jack.A
+com.android.jack.shrob.test011.jack.A: java.lang.Object keep1()
diff --git a/jack-tests/tests/com/android/jack/shrob/test011/refsSeed/expected-002.txt b/jack-tests/tests/com/android/jack/shrob/test011/refsSeed/expected-002.txt
new file mode 100644
index 0000000..9857ef1
--- /dev/null
+++ b/jack-tests/tests/com/android/jack/shrob/test011/refsSeed/expected-002.txt
@@ -0,0 +1,2 @@
+com.android.jack.shrob.test011.jack.A
+com.android.jack.shrob.test011.jack.A: int keep2()
diff --git a/jack-tests/tests/com/android/jack/shrob/test011/refsShrinking/expected-001.txt b/jack-tests/tests/com/android/jack/shrob/test011/refsShrinking/expected-001.txt
new file mode 100644
index 0000000..6480ca9
--- /dev/null
+++ b/jack-tests/tests/com/android/jack/shrob/test011/refsShrinking/expected-001.txt
@@ -0,0 +1,7 @@
+Lcom/android/jack/shrob/test011/jack/C;:
+<init>()V
+Lcom/android/jack/shrob/test011/jack/A;:
+<init>()V
+keep1()Ljava/lang/Object;
+Lcom/android/jack/shrob/test011/jack/B;:
+<init>()V
diff --git a/jack-tests/tests/com/android/jack/shrob/test011/refsShrinking/expected-002.txt b/jack-tests/tests/com/android/jack/shrob/test011/refsShrinking/expected-002.txt
new file mode 100644
index 0000000..2d05e6f
--- /dev/null
+++ b/jack-tests/tests/com/android/jack/shrob/test011/refsShrinking/expected-002.txt
@@ -0,0 +1,6 @@
+Lcom/android/jack/shrob/test011/jack/A;:
+<init>()V
+keep2()I
+Lcom/android/jack/shrob/test011/jack/B;:
+<init>()V
+value()I
diff --git a/jack-tests/tests/com/android/jack/shrob/test011/test.mk b/jack-tests/tests/com/android/jack/shrob/test011/test.mk
new file mode 100644
index 0000000..77f1391
--- /dev/null
+++ b/jack-tests/tests/com/android/jack/shrob/test011/test.mk
@@ -0,0 +1,25 @@
+# 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.
+
+private_path:= $(call my-dir)
+
+include $(JACK_CLEAR_VARS)
+
+JACKTEST_MODULE := shrob/test011
+JACKTEST_ARGS := --proguard-flags $(private_path)/proguard.flags001 --proguard-flags $(private_path)/../dontobfuscate.flags
+JACKTEST_WITHJACK_SRC := $(call all-java-files-under, $(abspath $(private_path)/jack/))
+JACKTEST_WITHDX_SRC := $(private_path)/dx/Tests.java
+JACKTEST_JUNIT := com.android.jack.$(subst /,.,$(JACKTEST_MODULE)).dx.Tests
+
+include $(JACK_RUN_TEST)
diff --git a/jack-tests/tests/com/android/jack/shrob/test011/test2.mk b/jack-tests/tests/com/android/jack/shrob/test011/test2.mk
new file mode 100644
index 0000000..457cb05
--- /dev/null
+++ b/jack-tests/tests/com/android/jack/shrob/test011/test2.mk
@@ -0,0 +1,25 @@
+# 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.
+
+private_path:= $(call my-dir)
+
+include $(JACK_CLEAR_VARS)
+
+JACKTEST_MODULE := shrob/test011_2
+JACKTEST_ARGS := --proguard-flags $(private_path)/proguard.flags002
+JACKTEST_WITHJACK_SRC := $(call all-java-files-under, $(abspath $(private_path)/jack/))
+JACKTEST_WITHDX_SRC := $(private_path)/dx/Tests2.java
+JACKTEST_JUNIT := com.android.jack.shrob.test011.dx.Tests2
+
+include $(JACK_RUN_TEST)