aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/tools
diff options
context:
space:
mode:
authorGravatar cnsun <cnsun@google.com>2017-05-23 00:38:56 +0200
committerGravatar Irina Iancu <elenairina@google.com>2017-05-23 12:47:15 +0200
commit2238b5df580d9a30cce7ad1fe25c1c84abdda268 (patch)
tree3768f9e53c77040a7f9a00165dbcecca9fe91e27 /src/tools
parent7cf441a508151886a12eaab01e8b87a711c8ae7f (diff)
Make checking of lambda dump directory accept relative path.
Before, we use Path.equals(Object), which will fail if we use relative path in the system property. Now I use Files.isSameFile which will check two paths point to the same file system resource. In https://github.com/bazelbuild/bazel/commit/69e855c7b0f0f7899a69a882cba0abd304233c97, I introduce the check to test whether setting the system property for lambda meta factory succeeds. However, the check does not consider relative path, which will always fail. RELNOTES: n/a PiperOrigin-RevId: 156796457
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/android/java/com/google/devtools/build/android/desugar/Desugar.java4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/tools/android/java/com/google/devtools/build/android/desugar/Desugar.java b/src/tools/android/java/com/google/devtools/build/android/desugar/Desugar.java
index 10c2b99e19..3d6e6c6dec 100644
--- a/src/tools/android/java/com/google/devtools/build/android/desugar/Desugar.java
+++ b/src/tools/android/java/com/google/devtools/build/android/desugar/Desugar.java
@@ -543,7 +543,7 @@ class Desugar {
new Desugar(options, dumpDirectory).desugar();
}
- static void verifyLambdaDumpDirectoryRegistered(Path dumpDirectory) {
+ static void verifyLambdaDumpDirectoryRegistered(Path dumpDirectory) throws IOException {
try {
Class<?> klass = Class.forName("java.lang.invoke.InnerClassLambdaMetafactory");
Field dumperField = klass.getDeclaredField("dumper");
@@ -555,7 +555,7 @@ class Desugar {
dumperPathField.setAccessible(true);
Object dumperPath = dumperPathField.get(dumperValue);
checkState(
- dumpDirectory.equals(dumperPath),
+ dumperPath instanceof Path && Files.isSameFile(dumpDirectory, (Path) dumperPath),
"Inconsistent lambda dump directories. real='%s', expected='%s'",
dumperPath,
dumpDirectory);