Merge "Adapt invalid name tests to run them on Java 9 runtime"
diff --git a/src/test/java/com/android/tools/r8/ToolHelper.java b/src/test/java/com/android/tools/r8/ToolHelper.java
index 12d1d5a..0a26131 100644
--- a/src/test/java/com/android/tools/r8/ToolHelper.java
+++ b/src/test/java/com/android/tools/r8/ToolHelper.java
@@ -545,6 +545,10 @@
return getPlatform().startsWith("Windows");
}
+ public static boolean isJava9Runtime() {
+ return System.getProperty("java.specification.version").equals("9");
+ }
+
public static boolean artSupported() {
if (!isLinux() && !isMac() && !isWindows()) {
System.err.println("Testing on your platform is not fully supported. " +
diff --git a/src/test/java/com/android/tools/r8/jasmin/InvalidClassNames.java b/src/test/java/com/android/tools/r8/jasmin/InvalidClassNames.java
index 813ea1b..c5566fc 100644
--- a/src/test/java/com/android/tools/r8/jasmin/InvalidClassNames.java
+++ b/src/test/java/com/android/tools/r8/jasmin/InvalidClassNames.java
@@ -52,20 +52,20 @@
@Parameters
public static Collection<Object[]> data() {
return Arrays.asList(new Object[][] {
- { new String(new int[] { 0x00a0 }, 0, 1), true },
- { new String(new int[] { 0x2000 }, 0, 1), !ToolHelper.isWindows() },
- { new String(new int[] { 0x200f }, 0, 1), !ToolHelper.isWindows() },
- { new String(new int[] { 0x2028 }, 0, 1), !ToolHelper.isWindows() },
- { new String(new int[] { 0x202f }, 0, 1), !ToolHelper.isWindows() },
- { new String(new int[] { 0xd800 }, 0, 1), false },
- { new String(new int[] { 0xdfff }, 0, 1), false },
- { new String(new int[] { 0xfff0 }, 0, 1), !ToolHelper.isWindows() },
- { new String(new int[] { 0xffff }, 0, 1), !ToolHelper.isWindows() },
+ { "\u00a0", !ToolHelper.isJava9Runtime()},
+ { "\u2000", !ToolHelper.isWindows() && !ToolHelper.isJava9Runtime()},
+ { "\u200f", !ToolHelper.isWindows() && !ToolHelper.isJava9Runtime()},
+ { "\u2028", !ToolHelper.isWindows() && !ToolHelper.isJava9Runtime()},
+ { "\u202f", !ToolHelper.isWindows() && !ToolHelper.isJava9Runtime()},
+ { "\ud800", false},
+ { "\udfff", false},
+ { "\ufff0", !ToolHelper.isWindows() && !ToolHelper.isJava9Runtime()},
+ { "\uffff", !ToolHelper.isWindows() && !ToolHelper.isJava9Runtime()},
{ "a/b/c/a/D/", true },
- { "a<b", !ToolHelper.isWindows() },
- { "a>b", !ToolHelper.isWindows() },
- { "<a>b", !ToolHelper.isWindows() },
- { "<a>", !ToolHelper.isWindows() }
+ { "a<b", !ToolHelper.isWindows() && !ToolHelper.isJava9Runtime()},
+ { "a>b", !ToolHelper.isWindows() && !ToolHelper.isJava9Runtime()},
+ { "<a>b", !ToolHelper.isWindows() && !ToolHelper.isJava9Runtime()},
+ { "<a>", !ToolHelper.isWindows() && !ToolHelper.isJava9Runtime()}
});
}
diff --git a/src/test/java/com/android/tools/r8/jasmin/InvalidFieldNames.java b/src/test/java/com/android/tools/r8/jasmin/InvalidFieldNames.java
index 4710e69..b182cd8 100644
--- a/src/test/java/com/android/tools/r8/jasmin/InvalidFieldNames.java
+++ b/src/test/java/com/android/tools/r8/jasmin/InvalidFieldNames.java
@@ -7,6 +7,7 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
+import com.android.tools.r8.ToolHelper;
import com.android.tools.r8.errors.CompilationError;
import java.util.Arrays;
import java.util.Collection;
@@ -48,20 +49,20 @@
@Parameters
public static Collection<Object[]> data() {
return Arrays.asList(new Object[][] {
- { new String(new int[] { 0x00a0 }, 0, 1), true },
- { new String(new int[] { 0x2000 }, 0, 1), true },
- { new String(new int[] { 0x200f }, 0, 1), true },
- { new String(new int[] { 0x2028 }, 0, 1), true },
- { new String(new int[] { 0x202f }, 0, 1), true },
- { new String(new int[] { 0xd800 }, 0, 1), true },
- { new String(new int[] { 0xdfff }, 0, 1), true },
- { new String(new int[] { 0xfff0 }, 0, 1), true },
- { new String(new int[] { 0xffff }, 0, 1), true },
+ { "\u00a0", !ToolHelper.isJava9Runtime()},
+ { "\u2000", !ToolHelper.isJava9Runtime()},
+ { "\u200f", !ToolHelper.isJava9Runtime()},
+ { "\u2028", !ToolHelper.isJava9Runtime()},
+ { "\u202f", !ToolHelper.isJava9Runtime()},
+ { "\ud800", !ToolHelper.isJava9Runtime()},
+ { "\udfff", !ToolHelper.isJava9Runtime()},
+ { "\ufff0", !ToolHelper.isJava9Runtime()},
+ { "\uffff", !ToolHelper.isJava9Runtime()},
{ "a/b", false },
{ "<a", false },
- { "a>", true },
- { "a<b>", true },
- { "<a>b", true }
+ { "a>", !ToolHelper.isJava9Runtime() },
+ { "a<b>", !ToolHelper.isJava9Runtime() },
+ { "<a>b", !ToolHelper.isJava9Runtime() }
});
}
diff --git a/src/test/java/com/android/tools/r8/jasmin/InvalidMethodNames.java b/src/test/java/com/android/tools/r8/jasmin/InvalidMethodNames.java
index cbf40a2..7b035f6 100644
--- a/src/test/java/com/android/tools/r8/jasmin/InvalidMethodNames.java
+++ b/src/test/java/com/android/tools/r8/jasmin/InvalidMethodNames.java
@@ -7,6 +7,7 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
+import com.android.tools.r8.ToolHelper;
import com.android.tools.r8.errors.CompilationError;
import com.google.common.collect.ImmutableList;
import java.util.Arrays;
@@ -52,18 +53,18 @@
@Parameters
public static Collection<Object[]> data() {
return Arrays.asList(new Object[][] {
- { new String(new int[] { 0x00a0 }, 0, 1), true },
- { new String(new int[] { 0x2000 }, 0, 1), true },
- { new String(new int[] { 0x200f }, 0, 1), true },
- { new String(new int[] { 0x2028 }, 0, 1), true },
- { new String(new int[] { 0x202f }, 0, 1), true },
- { new String(new int[] { 0xd800 }, 0, 1), true },
- { new String(new int[] { 0xdfff }, 0, 1), true },
- { new String(new int[] { 0xfff0 }, 0, 1), true },
- { new String(new int[] { 0xffff }, 0, 1), true },
+ { "\u00a0", !ToolHelper.isJava9Runtime()},
+ { "\u2000", !ToolHelper.isJava9Runtime()},
+ { "\u200f", !ToolHelper.isJava9Runtime()},
+ { "\u2028", !ToolHelper.isJava9Runtime()},
+ { "\u202f", !ToolHelper.isJava9Runtime()},
+ { "\ud800", !ToolHelper.isJava9Runtime()},
+ { "\udfff", !ToolHelper.isJava9Runtime()},
+ { "\ufff0", !ToolHelper.isJava9Runtime()},
+ { "\uffff", !ToolHelper.isJava9Runtime()},
{ "a/b", false },
{ "<a", false },
- { "a>", true },
+ { "a>", !ToolHelper.isJava9Runtime() },
{ "<a>", false }
});
}