diff options
author | delphinemartin <delphinemartin@google.com> | 2014-05-15 15:32:37 +0200 |
---|---|---|
committer | delphinemartin <delphinemartin@google.com> | 2014-05-26 16:40:06 +0200 |
commit | 41df3335cffe7f454e8b2a03a673355740c90f68 (patch) | |
tree | b05993f01dadc605693e97bd9208546bd43bec01 | |
parent | d3bbda7b02f27c24818ccb0011b44f42c9a66465 (diff) | |
download | toolchain_jack-41df3335cffe7f454e8b2a03a673355740c90f68.zip toolchain_jack-41df3335cffe7f454e8b2a03a673355740c90f68.tar.gz toolchain_jack-41df3335cffe7f454e8b2a03a673355740c90f68.tar.bz2 |
Added failing shrob test with successive reflection calls.
This is a test for the feature request 15258905.
Change-Id: I28d9a1c7d78abda43aa18fed12fb1057310bc43e
12 files changed, 106 insertions, 0 deletions
diff --git a/jack-tests/tests/com/android/jack/shrob/test041/info.txt b/jack-tests/tests/com/android/jack/shrob/test041/info.txt new file mode 100644 index 0000000..d28e87f --- /dev/null +++ b/jack-tests/tests/com/android/jack/shrob/test041/info.txt @@ -0,0 +1 @@ +This test contains successive reflection calls.
\ No newline at end of file diff --git a/jack-tests/tests/com/android/jack/shrob/test041/jack/Kept.java b/jack-tests/tests/com/android/jack/shrob/test041/jack/Kept.java new file mode 100644 index 0000000..d6e749e --- /dev/null +++ b/jack-tests/tests/com/android/jack/shrob/test041/jack/Kept.java @@ -0,0 +1,35 @@ +/* + * 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.shrob.test041.jack; + +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; + +public class Kept { + public static int kept() + throws NoSuchMethodException, + SecurityException, + ClassNotFoundException, + IllegalAccessException, + IllegalArgumentException, + InvocationTargetException { + Method method = Class.forName("com.android.jack.shrob.test041.jack.ReflectionClass").getMethod( + "reflectionMethod"); + Integer result = (Integer) method.invoke(null); + return result.intValue(); + } +} diff --git a/jack-tests/tests/com/android/jack/shrob/test041/jack/ReflectionClass.java b/jack-tests/tests/com/android/jack/shrob/test041/jack/ReflectionClass.java new file mode 100644 index 0000000..b1948f1 --- /dev/null +++ b/jack-tests/tests/com/android/jack/shrob/test041/jack/ReflectionClass.java @@ -0,0 +1,23 @@ +/* + * 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.shrob.test041.jack; + +public class ReflectionClass { + public static int reflectionMethod() { + return 42; + } +} diff --git a/jack-tests/tests/com/android/jack/shrob/test041/proguard.flags001 b/jack-tests/tests/com/android/jack/shrob/test041/proguard.flags001 new file mode 100644 index 0000000..b9bf8ed --- /dev/null +++ b/jack-tests/tests/com/android/jack/shrob/test041/proguard.flags001 @@ -0,0 +1,3 @@ +-keep class **.Kept { + *; +}
\ No newline at end of file diff --git a/jack-tests/tests/com/android/jack/shrob/test041/proguard.flags001.mapping b/jack-tests/tests/com/android/jack/shrob/test041/proguard.flags001.mapping new file mode 100644 index 0000000..eee367d --- /dev/null +++ b/jack-tests/tests/com/android/jack/shrob/test041/proguard.flags001.mapping @@ -0,0 +1,2 @@ +com.android.jack.shrob.test041.jack.ReflectionClass -> com.android.jack.shrob.test041.jack.RenamedReflectionClass: + int reflectionMethod() -> renamedReflectionMethod
\ No newline at end of file diff --git a/jack-tests/tests/com/android/jack/shrob/test041/refsFlattenPackage/expected-001.txt b/jack-tests/tests/com/android/jack/shrob/test041/refsFlattenPackage/expected-001.txt new file mode 100644 index 0000000..486240f --- /dev/null +++ b/jack-tests/tests/com/android/jack/shrob/test041/refsFlattenPackage/expected-001.txt @@ -0,0 +1,6 @@ +com.android.jack.shrob.test041.jack.Kept -> com.android.jack.shrob.test041.jack.Kept: + void <init>() -> <init> + int kept() -> kept +com.android.jack.shrob.test041.jack.ReflectionClass -> com.android.jack.shrob.test041.jack.FrsyrphvcbPyngg: + void <init>() -> <init> + int reflectionMethod() -> frsyrphvcbZrhucq__ diff --git a/jack-tests/tests/com/android/jack/shrob/test041/refsObfuscationWithMapping/expected-001.txt b/jack-tests/tests/com/android/jack/shrob/test041/refsObfuscationWithMapping/expected-001.txt new file mode 100644 index 0000000..f9684bf --- /dev/null +++ b/jack-tests/tests/com/android/jack/shrob/test041/refsObfuscationWithMapping/expected-001.txt @@ -0,0 +1,6 @@ +com.android.jack.shrob.test041.jack.Kept -> com.android.jack.shrob.test041.jack.Kept: + void <init>() -> <init> + int kept() -> kept +com.android.jack.shrob.test041.jack.ReflectionClass -> com.android.jack.shrob.test041.jack.RenamedReflectionClass: + void <init>() -> <init> + int reflectionMethod() -> renamedReflectionMethod diff --git a/jack-tests/tests/com/android/jack/shrob/test041/refsObfuscationWithoutMapping/expected-001.txt b/jack-tests/tests/com/android/jack/shrob/test041/refsObfuscationWithoutMapping/expected-001.txt new file mode 100644 index 0000000..486240f --- /dev/null +++ b/jack-tests/tests/com/android/jack/shrob/test041/refsObfuscationWithoutMapping/expected-001.txt @@ -0,0 +1,6 @@ +com.android.jack.shrob.test041.jack.Kept -> com.android.jack.shrob.test041.jack.Kept: + void <init>() -> <init> + int kept() -> kept +com.android.jack.shrob.test041.jack.ReflectionClass -> com.android.jack.shrob.test041.jack.FrsyrphvcbPyngg: + void <init>() -> <init> + int reflectionMethod() -> frsyrphvcbZrhucq__ diff --git a/jack-tests/tests/com/android/jack/shrob/test041/refsRepackageClasses/expected-001.txt b/jack-tests/tests/com/android/jack/shrob/test041/refsRepackageClasses/expected-001.txt new file mode 100644 index 0000000..b794c87 --- /dev/null +++ b/jack-tests/tests/com/android/jack/shrob/test041/refsRepackageClasses/expected-001.txt @@ -0,0 +1,6 @@ +com.android.jack.shrob.test041.jack.Kept -> com.android.jack.shrob.test041.jack.Kept: + void <init>() -> <init> + int kept() -> kept +com.android.jack.shrob.test041.jack.ReflectionClass -> FrsyrphvcbPyngg: + void <init>() -> <init> + int reflectionMethod() -> frsyrphvcbZrhucq__ diff --git a/jack-tests/tests/com/android/jack/shrob/test041/refsSeed/expected-001.txt b/jack-tests/tests/com/android/jack/shrob/test041/refsSeed/expected-001.txt new file mode 100644 index 0000000..098ad5b --- /dev/null +++ b/jack-tests/tests/com/android/jack/shrob/test041/refsSeed/expected-001.txt @@ -0,0 +1,5 @@ +com.android.jack.shrob.test041.jack.Kept +com.android.jack.shrob.test041.jack.Kept: Kept() +com.android.jack.shrob.test041.jack.Kept: int kept() +com.android.jack.shrob.test041.jack.Kept: void <clinit>() +com.android.jack.shrob.test041.jack.Kept: void $init() diff --git a/jack-tests/tests/com/android/jack/shrob/test041/refsShrinking/expected-001.txt b/jack-tests/tests/com/android/jack/shrob/test041/refsShrinking/expected-001.txt new file mode 100644 index 0000000..febcf04 --- /dev/null +++ b/jack-tests/tests/com/android/jack/shrob/test041/refsShrinking/expected-001.txt @@ -0,0 +1,6 @@ +Lcom/android/jack/shrob/test041/jack/Kept;: +<init>()V +kept()I +Lcom/android/jack/shrob/test041/jack/ReflectionClass;: +<init>()V +reflectionMethod()I diff --git a/jack/tests/com/android/jack/shrob/AbstractTest.java b/jack/tests/com/android/jack/shrob/AbstractTest.java index 2c2e50a..02776ff 100644 --- a/jack/tests/com/android/jack/shrob/AbstractTest.java +++ b/jack/tests/com/android/jack/shrob/AbstractTest.java @@ -19,6 +19,7 @@ package com.android.jack.shrob; import com.android.jack.Main; import com.android.jack.ProguardFlags; import com.android.jack.TestTools; +import com.android.jack.category.KnownBugs; import com.android.jack.category.SlowTests; import org.junit.BeforeClass; @@ -552,4 +553,10 @@ public abstract class AbstractTest { public void test40_001() throws Exception { runTest(defaultBootclasspath, null, "040", "001", ""); } + + @Test + @Category(KnownBugs.class) + public void test41_001() throws Exception { + runTest(defaultBootclasspath, null, "041", "001", ""); + } } |