8260560: convert jdeps and jdeprscan tools to use Stream.toList()

Reviewed-by: alanb, mchung, iris
This commit is contained in:
Ian Graves 2021-04-30 19:51:36 +00:00 committed by Pavel Rappo
parent 096e9e5d13
commit c36c63a008
4 changed files with 9 additions and 9 deletions
src/jdk.jdeps/share/classes/com/sun/tools

@ -166,7 +166,7 @@ public class Main implements DiagnosticListener<JavaFileObject> {
if (forRemoval) {
deprList = proc.getDeprecations().stream()
.filter(DeprData::isForRemoval)
.collect(toList());
.toList();
} else {
deprList = proc.getDeprecations();
}
@ -190,7 +190,7 @@ public class Main implements DiagnosticListener<JavaFileObject> {
.filter(name -> !name.endsWith("module-info.class"))
.map(s -> s.replaceAll("\\.class$", ""))
.map(s -> s.replace(File.separatorChar, '.'))
.collect(toList()));
.toList());
}
/**
@ -227,7 +227,7 @@ public class Main implements DiagnosticListener<JavaFileObject> {
.filter(name -> !name.endsWith("module-info.class"))
.map(s -> s.replaceAll("\\.class$", ""))
.map(this::convertModularFileName)
.collect(toList()));
.toList());
}
/**
@ -406,7 +406,7 @@ public class Main implements DiagnosticListener<JavaFileObject> {
types.values().stream()
.flatMap(List::stream)
.map(TypeElement::toString)
.collect(toList()));
.toList());
} else {
JDKPlatformProvider pp = new JDKPlatformProvider();
if (StreamSupport.stream(pp.getSupportedPlatformNames().spliterator(),
@ -677,7 +677,7 @@ public class Main implements DiagnosticListener<JavaFileObject> {
DeprDB db = DeprDB.loadFromList(deprList);
List<String> cp = classPath.stream()
.map(File::toString)
.collect(toList());
.toList();
Scan scan = new Scan(out, err, cp, db, verbose);
for (String a : args) {

@ -635,7 +635,7 @@ public class Scan {
.filter(path -> path.toString().endsWith(".class"))
.filter(path -> !path.toString().endsWith("package-info.class"))
.filter(path -> !path.toString().endsWith("module-info.class"))
.collect(Collectors.toList());
.toList();
out.println(Messages.get("scan.head.dir", dirname));

@ -260,8 +260,8 @@ public class ClassFileReader implements Closeable {
DirectoryIterator() throws IOException {
List<Path> paths = null;
try (Stream<Path> stream = Files.walk(path, Integer.MAX_VALUE)) {
paths = stream.filter(ClassFileReader::isClass)
.collect(Collectors.toList());
paths = stream.filter(ClassFileReader::isClass).toList();
}
this.entries = paths;
this.index = 0;

@ -78,7 +78,7 @@ public class ModuleInfoBuilder {
// add targets to modulepath if it has module-info.class
List<Path> paths = args.stream()
.map(fn -> Paths.get(fn))
.collect(toList());
.toList();
// automatic module to convert to normal module
this.automaticToNormalModule = ModuleFinder.of(paths.toArray(new Path[0]))