Move api-sample to back of class path
Change-Id: I8ff7b8ba98b5747c66f6096558d62fcdd5b7e888
diff --git a/src/test/java/com/android/tools/r8/D8ApiBinaryCompatibilityTests.java b/src/test/java/com/android/tools/r8/D8ApiBinaryCompatibilityTests.java
index 6d0ef5a..c5e44a3 100644
--- a/src/test/java/com/android/tools/r8/D8ApiBinaryCompatibilityTests.java
+++ b/src/test/java/com/android/tools/r8/D8ApiBinaryCompatibilityTests.java
@@ -49,13 +49,16 @@
Path mainDexList = temp.getRoot().toPath().resolve("maindexlist.txt");
FileUtils.writeTextFile(mainDexList, "desugaringwithmissingclasstest1/Main.class");
+ // It is important to place the api usage sample jar after the current classpath because we want
+ // to find D8/R8 classes before the ones in the jar, otherwise renamed classes and fields cannot
+ // be found.
+ String classPath = System.getProperty("java.class.path") + File.pathSeparator + jar.toString();
List<String> command =
ImmutableList.<String>builder()
.addAll(
ImmutableList.of(
ToolHelper.getJavaExecutable(),
- "-cp",
- jar.toString() + File.pathSeparator + System.getProperty("java.class.path"),
+ "-cp", classPath,
main,
// Compiler arguments.
"--output",