Skip to content
Permalink
Browse files
8260560: convert jdeps and jdeprscan tools to use Stream.toList()
Reviewed-by: alanb, mchung, iris
  • Loading branch information
Ian Graves authored and pavelrappo committed Apr 30, 2021
1 parent 096e9e5 commit c36c63a008fa5e8b00dfc36c887cd9497fb91ab5
@@ -166,7 +166,7 @@ boolean doClassNames(Collection<String> classNames) throws IOException {
if (forRemoval) {
deprList = proc.getDeprecations().stream()
.filter(DeprData::isForRemoval)
.collect(toList());
.toList();
} else {
deprList = proc.getDeprecations();
}
@@ -190,7 +190,7 @@ boolean doFileNames(Stream<String> filenames) throws IOException {
.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 @@ boolean doModularFileNames(Stream<String> filenames) throws IOException {
.filter(name -> !name.endsWith("module-info.class"))
.map(s -> s.replaceAll("\\.class$", ""))
.map(this::convertModularFileName)
.collect(toList()));
.toList());
}

/**
@@ -406,7 +406,7 @@ boolean processRelease(String release, Collection<String> classes) throws IOExce
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 @@ boolean run(String... argArray) {
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 boolean scanDir(String dirname) {
.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 ClassFile getClassFile(String name) throws IOException {
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 ModuleInfoBuilder(JdepsConfiguration configuration,
// 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]))

1 comment on commit c36c63a

@openjdk-notifier

This comment has been minimized.

Copy link

@openjdk-notifier openjdk-notifier bot commented on c36c63a Apr 30, 2021

Please sign in to comment.