diff options
author | cushon <cushon@google.com> | 2017-03-14 11:28:18 -0700 |
---|---|---|
committer | Liam Miller-Cushon <cushon@google.com> | 2017-03-18 00:23:38 -0700 |
commit | a5beb1786cb534d7bfe2b4cd5f8e31464e7b3e8e (patch) | |
tree | 5f2aad79da5e60c81a7d733751ccc99a995c3c20 | |
parent | 466e61c082af2d622db5549eff8ab9f338cd6435 (diff) | |
download | turbine-a5beb1786cb534d7bfe2b4cd5f8e31464e7b3e8e.tar.gz |
Don't declare parameters of type Iterable<Path>
context: https://bugs.openjdk.java.net/browse/JDK-8150111
MOE_MIGRATED_REVID=150091106
4 files changed, 17 insertions, 18 deletions
diff --git a/java/com/google/turbine/binder/Binder.java b/java/com/google/turbine/binder/Binder.java index 121c96e..528fa34 100644 --- a/java/com/google/turbine/binder/Binder.java +++ b/java/com/google/turbine/binder/Binder.java @@ -71,7 +71,7 @@ public class Binder { /** Binds symbols and types to the given compilation units. */ public static BindingResult bind( - List<CompUnit> units, Iterable<Path> classpath, Iterable<Path> bootclasspath) + List<CompUnit> units, Collection<Path> classpath, Collection<Path> bootclasspath) throws IOException { TopLevelIndex.Builder tliBuilder = TopLevelIndex.builder(); diff --git a/java/com/google/turbine/binder/ClassPathBinder.java b/java/com/google/turbine/binder/ClassPathBinder.java index af94fed..fd29e53 100644 --- a/java/com/google/turbine/binder/ClassPathBinder.java +++ b/java/com/google/turbine/binder/ClassPathBinder.java @@ -29,6 +29,7 @@ import com.google.turbine.binder.sym.ClassSymbol; import java.io.IOError; import java.io.IOException; import java.nio.file.Path; +import java.util.Collection; import java.util.Enumeration; import java.util.HashMap; import java.util.LinkedHashMap; @@ -50,7 +51,7 @@ public class ClassPathBinder { * them to the top-level index. */ public static CompoundEnv<ClassSymbol, BytecodeBoundClass> bind( - Iterable<Path> classpath, Iterable<Path> bootclasspath, TopLevelIndex.Builder tli) + Collection<Path> classpath, Collection<Path> bootclasspath, TopLevelIndex.Builder tli) throws IOException { // TODO(cushon): this is going to require an env eventually, // e.g. to look up type parameters in enclosing declarations @@ -60,7 +61,7 @@ public class ClassPathBinder { } private static Env<ClassSymbol, BytecodeBoundClass> bindClasspath( - TopLevelIndex.Builder tli, Iterable<Path> paths) throws IOException { + TopLevelIndex.Builder tli, Collection<Path> paths) throws IOException { Map<ClassSymbol, BytecodeBoundClass> transitive = new LinkedHashMap<>(); Map<ClassSymbol, BytecodeBoundClass> map = new HashMap<>(); Env<ClassSymbol, BytecodeBoundClass> benv = diff --git a/java/com/google/turbine/main/Main.java b/java/com/google/turbine/main/Main.java index 563bc73..ac0db76 100644 --- a/java/com/google/turbine/main/Main.java +++ b/java/com/google/turbine/main/Main.java @@ -18,9 +18,7 @@ package com.google.turbine.main; import static java.nio.charset.StandardCharsets.UTF_8; -import com.google.common.base.Function; import com.google.common.collect.ImmutableList; -import com.google.common.collect.Iterables; import com.google.common.hash.Hashing; import com.google.common.io.ByteStreams; import com.google.turbine.binder.Binder; @@ -77,10 +75,7 @@ public class Main { options.classPath(), options.directJarsToTargets(), options.depsArtifacts()); BindingResult bound = - Binder.bind( - units, - Iterables.transform(reducedClasspath, TO_PATH), - Iterables.transform(options.bootClassPath(), TO_PATH)); + Binder.bind(units, toPaths(reducedClasspath), toPaths(options.bootClassPath())); // TODO(cushon): parallelize Lowered lowered = Lower.lowerAll(bound.units(), bound.classPathEnv()); @@ -150,11 +145,11 @@ public class Main { jos.write(bytes); } - private static final Function<String, Path> TO_PATH = - new Function<String, Path>() { - @Override - public Path apply(String input) { - return Paths.get(input); - } - }; + private static ImmutableList<Path> toPaths(Iterable<String> paths) { + ImmutableList.Builder<Path> result = ImmutableList.builder(); + for (String path : paths) { + result.add(Paths.get(path)); + } + return result.build(); + } } diff --git a/javatests/com/google/turbine/lower/IntegrationTestSupport.java b/javatests/com/google/turbine/lower/IntegrationTestSupport.java index 81ca70a..4e64964 100644 --- a/javatests/com/google/turbine/lower/IntegrationTestSupport.java +++ b/javatests/com/google/turbine/lower/IntegrationTestSupport.java @@ -47,6 +47,7 @@ import java.nio.file.SimpleFileVisitor; import java.nio.file.attribute.BasicFileAttributes; import java.util.ArrayDeque; import java.util.ArrayList; +import java.util.Collection; import java.util.Collections; import java.util.Comparator; import java.util.Deque; @@ -424,7 +425,7 @@ public class IntegrationTestSupport { } static Map<String, byte[]> runTurbine( - Map<String, String> input, ImmutableList<Path> classpath, Iterable<Path> bootclasspath) + Map<String, String> input, ImmutableList<Path> classpath, Collection<Path> bootclasspath) throws IOException { List<Tree.CompUnit> units = input @@ -439,7 +440,9 @@ public class IntegrationTestSupport { } public static Map<String, byte[]> runJavac( - Map<String, String> sources, Iterable<Path> classpath, Iterable<? extends Path> bootclasspath) + Map<String, String> sources, + Collection<Path> classpath, + Collection<? extends Path> bootclasspath) throws Exception { FileSystem fs = Jimfs.newFileSystem(Configuration.unix()); |