Skip to content
Snippets Groups Projects
Commit f5563b11 authored by Delphine Martin's avatar Delphine Martin Committed by Gerrit Code Review
Browse files

Merge "Add tracing for default methods" into ub-jack

parents 82a773d2 2f95f83b
Branches
Tags ub-jack-douarn-b9
No related merge requests found
Showing
with 385 additions and 3 deletions
......@@ -1020,6 +1020,8 @@
<exclude name="com/android/jack/sourcepath/test002/jack/Sourcepath002.java"/>
<exclude name="com/android/jack/shrob/test062/jack/**"/>
<exclude name="com/android/jack/shrob/test066/jack/**"/>
<exclude name="com/android/jack/shrob/test067/jack/**"/>
<exclude name="com/android/jack/shrob/test068/jack/**"/>
<classpath>
<filelist dir="/">
<file name="${jill-api.dist.dir}/${jill-api.lib.name}" />
......
......@@ -2,7 +2,7 @@
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<classpathentry excluding="com/android/jack/annotation/test014/jack/|com/android/jack/annotation/test015/jack/|com/android/jack/annotation/test016/jack/|com/android/jack/annotation/test017/jack/|com/android/jack/classpath/test002/lib1override/|com/android/jack/compiletime/test*/**|com/android/jack/enums/test003/link/Other.java|com/android/jack/enums/test003/link/Values.java|com/android/jack/error/test001/jack/A.java|com/android/jack/error/test002/jack/A.java|com/android/jack/frontend/test002/jack/PackageName/ClassInConflictingPackage.java|com/android/jack/frontend/test005/jack/|com/android/jack/frontend/test006/jack/|com/android/jack/frontend/test007/jack/|com/android/jack/frontend/test007/jackduplicate/|com/android/jack/frontend/test008/jack/NoOuterContext.java|com/android/jack/frontend/test010/jack/UnusedLocalVar.java|com/android/jack/frontend/test013/jack/ExtendingInnerOnly.java|com/android/jack/frontend/test014/jack/ExtendingInnerInStaticContext.java|com/android/jack/frontend/test015/jack/WithOuterContextButStatic.java|com/android/jack/frontend/test016/jack/WithDuplicated.java|com/android/jack/frontend/test017/jack/InvalidQualification.java|com/android/jack/jarjar/test003/dontcompile/|com/android/jack/jarjar/test004/dontcompile/|com/android/jack/java8/annotation/|com/android/jack/java8/defaultmethod/|com/android/jack/java8/gwt/|com/android/jack/java8/inference/|com/android/jack/java8/intersectiontype/|com/android/jack/java8/lambda/|com/android/jack/java8/methodref/|com/android/jack/java8/retrolambda/|com/android/jack/java8/staticmethod/|com/android/jack/java8/variable/|com/android/jack/lookup/test001/liboverride/|com/android/jack/nopackage/test*/**|com/android/jack/optimizations/lambdas/test*/**|com/android/jack/jarjar/test006/dontcompile/|com/android/jack/java8/bridges/|com/android/jack/jill/test001/|com/android/jack/jill/test002/|com/android/jack/jill/test003/|com/android/jack/jill/test004/|com/android/jack/sourcepath/test002/jack/Sourcepath002.java|com/android/jack/annotation/test019/jack/|com/android/jack/frontend/test018/jack/|com/android/jack/annotation/test020/jack/|com/android/jack/assign/test002/jack/|com/android/jack/annotation/processor/sample2/src/|com/android/jack/shrob/test062/jack/Tests.java|com/android/jack/shrob/test062/jack/A.java|com/android/jack/coverage/test006_v1/jack/|com/android/jack/coverage/test006_v2/jack/|com/android/jack/multidex/test004/jack/|com/android/jack/shrob/test066/jack/MySuperInterfaceWithDefaultMethod.java|com/android/jack/shrob/test066/jack/MyClass.java" kind="src" path="tests"/>
<classpathentry excluding="com/android/jack/annotation/test014/jack/|com/android/jack/annotation/test015/jack/|com/android/jack/annotation/test016/jack/|com/android/jack/annotation/test017/jack/|com/android/jack/classpath/test002/lib1override/|com/android/jack/compiletime/test*/**|com/android/jack/enums/test003/link/Other.java|com/android/jack/enums/test003/link/Values.java|com/android/jack/error/test001/jack/A.java|com/android/jack/error/test002/jack/A.java|com/android/jack/frontend/test002/jack/PackageName/ClassInConflictingPackage.java|com/android/jack/frontend/test005/jack/|com/android/jack/frontend/test006/jack/|com/android/jack/frontend/test007/jack/|com/android/jack/frontend/test007/jackduplicate/|com/android/jack/frontend/test008/jack/NoOuterContext.java|com/android/jack/frontend/test010/jack/UnusedLocalVar.java|com/android/jack/frontend/test013/jack/ExtendingInnerOnly.java|com/android/jack/frontend/test014/jack/ExtendingInnerInStaticContext.java|com/android/jack/frontend/test015/jack/WithOuterContextButStatic.java|com/android/jack/frontend/test016/jack/WithDuplicated.java|com/android/jack/frontend/test017/jack/InvalidQualification.java|com/android/jack/jarjar/test003/dontcompile/|com/android/jack/jarjar/test004/dontcompile/|com/android/jack/java8/annotation/|com/android/jack/java8/defaultmethod/|com/android/jack/java8/gwt/|com/android/jack/java8/inference/|com/android/jack/java8/intersectiontype/|com/android/jack/java8/lambda/|com/android/jack/java8/methodref/|com/android/jack/java8/retrolambda/|com/android/jack/java8/staticmethod/|com/android/jack/java8/variable/|com/android/jack/lookup/test001/liboverride/|com/android/jack/nopackage/test*/**|com/android/jack/optimizations/lambdas/test*/**|com/android/jack/jarjar/test006/dontcompile/|com/android/jack/java8/bridges/|com/android/jack/jill/test001/|com/android/jack/jill/test002/|com/android/jack/jill/test003/|com/android/jack/jill/test004/|com/android/jack/sourcepath/test002/jack/Sourcepath002.java|com/android/jack/annotation/test019/jack/|com/android/jack/frontend/test018/jack/|com/android/jack/annotation/test020/jack/|com/android/jack/assign/test002/jack/|com/android/jack/annotation/processor/sample2/src/|com/android/jack/shrob/test062/jack/Tests.java|com/android/jack/shrob/test062/jack/A.java|com/android/jack/coverage/test006_v1/jack/|com/android/jack/coverage/test006_v2/jack/|com/android/jack/multidex/test004/jack/|com/android/jack/shrob/test066/jack/MySuperInterfaceWithDefaultMethod.java|com/android/jack/shrob/test066/jack/MyClass.java|com/android/jack/shrob/test068/jack/I1.java|com/android/jack/shrob/test068/jack/I2.java|com/android/jack/shrob/test068/jack/I2Impl.java|com/android/jack/shrob/test068/jack/I2ImplImpl.java|com/android/jack/shrob/test068/jack/Kept.java|com/android/jack/shrob/test067/jack/MyInterfaceWithDefaultMethod.java|com/android/jack/shrob/test067/jack/MyClass.java|com/android/jack/shrob/test067/jack/Kept.java" kind="src" path="tests"/>
<classpathentry kind="lib" path="libs/junit4.jar"/>
<classpathentry kind="lib" path="libs/antlr-runtime-lib.jar"/>
<classpathentry kind="lib" path="libs/dx-ref.jar"/>
......
......@@ -18,7 +18,6 @@ package com.android.jack.shrob;
import com.android.jack.Options;
import com.android.jack.ProguardFlags;
import com.android.jack.backend.dex.compatibility.AndroidCompatibilityChecker;
import com.android.jack.shrob.shrink.ShrinkStructurePrinter;
import com.android.jack.test.category.SlowTests;
import com.android.jack.test.comparator.ComparatorMapping;
......@@ -500,7 +499,6 @@ public class ShrinkTests extends AbstractTest {
}
@Test
@KnownIssue
public void test66_001() throws Exception {
File testFolder = new File(shrobTestsDir, "test066");
......@@ -542,4 +540,148 @@ public class ShrinkTests extends AbstractTest {
env.runTest(
new ComparatorMapping(new File(refFolder, "expected-001.txt"), candidateNodeListing));
}
@Test
public void test67_001() throws Exception {
File testFolder = new File(shrobTestsDir, "test067");
JackBasedToolchain toolchain = AbstractTestTools.getCandidateToolchain(JackBasedToolchain.class);
File refFolder = new File(testFolder, "refsShrinking");
File candidateNodeListing = AbstractTestTools.createTempFile("nodeListing", ".txt");
toolchain.addProperty(ShrinkStructurePrinter.STRUCTURE_PRINTING.getName(), "true");
toolchain.addProperty(ShrinkStructurePrinter.STRUCTURE_PRINTING_FILE.getName(),
candidateNodeListing.getPath());
toolchain.addProperty(Options.METHOD_FILTER.getName(), "supported-methods");
toolchain
.addProperty(Options.ANDROID_MIN_API_LEVEL.getName(),
String.valueOf(AndroidApiLevel.ReleasedLevel.N.getLevel()))
.setSourceLevel(SourceLevel.JAVA_8);
toolchain.disableDxOptimizations();
File outFolder = AbstractTestTools.createTempDir();
SourceToDexComparisonTestHelper env =
new SourceToDexComparisonTestHelper(new File(testFolder, "jack"));
env.setWithDebugInfo(true);
env.setCandidateTestTools(toolchain);
env.setReferenceTestTools(new DummyToolchain());
env.setProguardFlags(dontObfuscateFlagFile,
new ProguardFlags(shrobTestsDir, "keepAllAttributes.flags"),
new ProguardFlags(testFolder, "proguard.flags001"));
env.setSourceLevel(SourceLevel.JAVA_8);
env.runTest(
new ComparatorMapping(new File(refFolder, "expected-001.txt"), candidateNodeListing));
}
@Test
public void test67_002() throws Exception {
File testFolder = new File(shrobTestsDir, "test067");
JackBasedToolchain toolchain = AbstractTestTools.getCandidateToolchain(JackBasedToolchain.class);
File refFolder = new File(testFolder, "refsShrinking");
File candidateNodeListing = AbstractTestTools.createTempFile("nodeListing", ".txt");
toolchain.addProperty(ShrinkStructurePrinter.STRUCTURE_PRINTING.getName(), "true");
toolchain.addProperty(ShrinkStructurePrinter.STRUCTURE_PRINTING_FILE.getName(),
candidateNodeListing.getPath());
toolchain.addProperty(Options.METHOD_FILTER.getName(), "supported-methods");
toolchain
.addProperty(Options.ANDROID_MIN_API_LEVEL.getName(),
String.valueOf(AndroidApiLevel.ReleasedLevel.N.getLevel()))
.setSourceLevel(SourceLevel.JAVA_8);
toolchain.disableDxOptimizations();
File outFolder = AbstractTestTools.createTempDir();
SourceToDexComparisonTestHelper env =
new SourceToDexComparisonTestHelper(new File(testFolder, "jack"));
env.setWithDebugInfo(true);
env.setCandidateTestTools(toolchain);
env.setReferenceTestTools(new DummyToolchain());
env.setProguardFlags(dontObfuscateFlagFile,
new ProguardFlags(shrobTestsDir, "keepAllAttributes.flags"),
new ProguardFlags(testFolder, "proguard.flags002"));
env.setSourceLevel(SourceLevel.JAVA_8);
env.runTest(
new ComparatorMapping(new File(refFolder, "expected-002.txt"), candidateNodeListing));
}
@Test
public void test68_001() throws Exception {
File testFolder = new File(shrobTestsDir, "test068");
JackBasedToolchain toolchain = AbstractTestTools.getCandidateToolchain(JackBasedToolchain.class);
File refFolder = new File(testFolder, "refsShrinking");
File candidateNodeListing = AbstractTestTools.createTempFile("nodeListing", ".txt");
toolchain.addProperty(ShrinkStructurePrinter.STRUCTURE_PRINTING.getName(), "true");
toolchain.addProperty(ShrinkStructurePrinter.STRUCTURE_PRINTING_FILE.getName(),
candidateNodeListing.getPath());
toolchain.addProperty(Options.METHOD_FILTER.getName(), "supported-methods");
toolchain
.addProperty(Options.ANDROID_MIN_API_LEVEL.getName(),
String.valueOf(AndroidApiLevel.ReleasedLevel.N.getLevel()))
.setSourceLevel(SourceLevel.JAVA_8);
toolchain.disableDxOptimizations();
File outFolder = AbstractTestTools.createTempDir();
SourceToDexComparisonTestHelper env =
new SourceToDexComparisonTestHelper(new File(testFolder, "jack"));
env.setWithDebugInfo(true);
env.setCandidateTestTools(toolchain);
env.setReferenceTestTools(new DummyToolchain());
env.setProguardFlags(dontObfuscateFlagFile,
new ProguardFlags(shrobTestsDir, "keepAllAttributes.flags"),
new ProguardFlags(testFolder, "proguard.flags001"));
env.setSourceLevel(SourceLevel.JAVA_8);
env.runTest(
new ComparatorMapping(new File(refFolder, "expected-001.txt"), candidateNodeListing));
}
@Test
public void test68_002() throws Exception {
File testFolder = new File(shrobTestsDir, "test068");
JackBasedToolchain toolchain = AbstractTestTools.getCandidateToolchain(JackBasedToolchain.class);
File refFolder = new File(testFolder, "refsShrinking");
File candidateNodeListing = AbstractTestTools.createTempFile("nodeListing", ".txt");
toolchain.addProperty(ShrinkStructurePrinter.STRUCTURE_PRINTING.getName(), "true");
toolchain.addProperty(ShrinkStructurePrinter.STRUCTURE_PRINTING_FILE.getName(),
candidateNodeListing.getPath());
toolchain.addProperty(Options.METHOD_FILTER.getName(), "supported-methods");
toolchain
.addProperty(Options.ANDROID_MIN_API_LEVEL.getName(),
String.valueOf(AndroidApiLevel.ReleasedLevel.N.getLevel()))
.setSourceLevel(SourceLevel.JAVA_8);
toolchain.disableDxOptimizations();
File outFolder = AbstractTestTools.createTempDir();
SourceToDexComparisonTestHelper env =
new SourceToDexComparisonTestHelper(new File(testFolder, "jack"));
env.setWithDebugInfo(true);
env.setCandidateTestTools(toolchain);
env.setReferenceTestTools(new DummyToolchain());
env.setProguardFlags(dontObfuscateFlagFile,
new ProguardFlags(shrobTestsDir, "keepAllAttributes.flags"),
new ProguardFlags(testFolder, "proguard.flags002"));
env.setSourceLevel(SourceLevel.JAVA_8);
env.runTest(
new ComparatorMapping(new File(refFolder, "expected-002.txt"), candidateNodeListing));
}
}
This tests contains a class with extends a class and implements an interface
both with the same concrete method.
\ No newline at end of file
/*
* Copyright (C) 2016 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.test067.jack;
public abstract class AbstractClass {
public int m() {
return 1;
}
}
/*
* Copyright (C) 2016 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.test067.jack;
public class Kept {
void kept(MyClass c) {
c.m();
}
}
/*
* Copyright (C) 2016 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.test067.jack;
public class MyClass extends AbstractClass implements MyInterfaceWithDefaultMethod {
}
/*
* Copyright (C) 2016 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.test067.jack;
public interface MyInterfaceWithDefaultMethod {
default int m() {
return 2;
}
}
-keep class **.Kept {
*;
}
\ No newline at end of file
-keep class **.Kept {
*;
}
-keep interface *
\ No newline at end of file
Lcom/android/jack/shrob/test067/jack/MyClass;:
<init>()V
Lcom/android/jack/shrob/test067/jack/AbstractClass;:
<init>()V
m()I
Lcom/android/jack/shrob/test067/jack/Kept;:
<init>()V
kept(Lcom/android/jack/shrob/test067/jack/MyClass;)V
\ No newline at end of file
Lcom/android/jack/shrob/test067/jack/MyClass;:
<init>()V
Lcom/android/jack/shrob/test067/jack/AbstractClass;:
<init>()V
m()I
Lcom/android/jack/shrob/test067/jack/Kept;:
<init>()V
kept(Lcom/android/jack/shrob/test067/jack/MyClass;)V
Lcom/android/jack/shrob/test067/jack/MyInterfaceWithDefaultMethod;:
\ No newline at end of file
This tests contains multiple interfaces with default methods to check if the
right implementation is kept.
\ No newline at end of file
/*
* Copyright (C) 2016 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.test068.jack;
public interface I1 {
default String m() {
return "I1.m";
}
}
/*
* Copyright (C) 2016 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.test068.jack;
public interface I2 extends I1{
default String m() {
return "I2.m";
}
}
/*
* Copyright (C) 2016 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.test068.jack;
public class I2Impl implements I2 {
}
/*
* Copyright (C) 2016 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.test068.jack;
public class I2ImplImpl extends I2Impl implements I1 {
}
/*
* Copyright (C) 2016 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.test068.jack;
public class Kept {
void kept1() {
new I2Impl().m();
}
void kept2() {
new I2ImplImpl().m();
}
}
-keep class **.Kept {
void kept1();
}
\ No newline at end of file
-keep class **.Kept {
void kept2();
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment