mirror of
https://github.com/openjdk/jdk.git
synced 2026-02-10 02:18:46 +00:00
8263621: Convert jdk.compiler to use Stream.toList()
Reviewed-by: mcimadamore, vromero
This commit is contained in:
parent
7df0c10a4d
commit
33a86b9e40
@ -204,7 +204,7 @@ public class BasicJavacTask extends JavacTask {
|
||||
java.util.List<String> options =
|
||||
pluginDesc.getOptions().entrySet().stream()
|
||||
.map(e -> e.getKey() + "=" + e.getValue())
|
||||
.collect(Collectors.toList());
|
||||
.toList();
|
||||
try {
|
||||
initPlugin(pluginDesc.getPlugin(), options.toArray(new String[options.size()]));
|
||||
} catch (RuntimeException ex) {
|
||||
|
||||
@ -491,7 +491,7 @@ public class JavacFileManager extends BaseFileManager implements StandardJavaFil
|
||||
|
||||
java.util.List<Path> files;
|
||||
try (Stream<Path> s = Files.list(d)) {
|
||||
files = (sortFiles == null ? s : s.sorted(sortFiles)).collect(Collectors.toList());
|
||||
files = (sortFiles == null ? s : s.sorted(sortFiles)).toList();
|
||||
} catch (IOException ignore) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -953,7 +953,7 @@ public class Locations {
|
||||
Path modules = javaHome.resolve("modules");
|
||||
if (Files.isDirectory(modules.resolve("java.base"))) {
|
||||
try (Stream<Path> listedModules = Files.list(modules)) {
|
||||
return listedModules.collect(Collectors.toList());
|
||||
return listedModules.toList();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -123,7 +123,7 @@ public class JavacTypes implements javax.lang.model.util.Types {
|
||||
Type ty = (Type)t;
|
||||
return types.directSupertypes(ty).stream()
|
||||
.map(Type::stripMetadataIfNeeded)
|
||||
.collect(Collectors.toList());
|
||||
.toList();
|
||||
}
|
||||
|
||||
@DefinedBy(Api.LANGUAGE_MODEL)
|
||||
|
||||
@ -343,7 +343,7 @@ public class JavacProcessingEnvironment implements ProcessingEnvironment, Closea
|
||||
platformProcessors = platformProvider.getAnnotationProcessors()
|
||||
.stream()
|
||||
.map(PluginInfo::getPlugin)
|
||||
.collect(Collectors.toList());
|
||||
.toList();
|
||||
}
|
||||
List<Iterator<? extends Processor>> iterators = List.of(processorIterator,
|
||||
platformProcessors.iterator());
|
||||
|
||||
@ -280,7 +280,7 @@ public class PrintingProcessor extends AbstractProcessor {
|
||||
e.getEnclosedElements()
|
||||
.stream()
|
||||
.filter(elt -> elementUtils.getOrigin(elt) == Elements.Origin.EXPLICIT )
|
||||
.collect(Collectors.toList()) ) )
|
||||
.toList() ) )
|
||||
this.visit(element);
|
||||
}
|
||||
|
||||
|
||||
@ -152,20 +152,20 @@ public class PubapiVisitor extends ElementScanner14<Void, Void> {
|
||||
private List<PubApiTypeParam> getTypeParameters(List<? extends TypeParameterElement> elements) {
|
||||
return elements.stream()
|
||||
.map(e -> new PubApiTypeParam(e.getSimpleName().toString(), getTypeDescs(e.getBounds())))
|
||||
.collect(Collectors.toList());
|
||||
.toList();
|
||||
}
|
||||
|
||||
private List<TypeMirror> getParamTypes(ExecutableElement e) {
|
||||
return e.getParameters()
|
||||
.stream()
|
||||
.map(VariableElement::asType)
|
||||
.collect(Collectors.toList());
|
||||
.toList();
|
||||
}
|
||||
|
||||
private List<TypeDesc> getTypeDescs(List<? extends TypeMirror> list) {
|
||||
return list.stream()
|
||||
.map(TypeDesc::fromType)
|
||||
.collect(Collectors.toList());
|
||||
.toList();
|
||||
}
|
||||
|
||||
public PubApi getCollectedPubApi() {
|
||||
|
||||
@ -272,11 +272,11 @@ public class PubApi implements Serializable {
|
||||
private static List<TypeDesc> parseTypeDescs(List<String> strs) {
|
||||
return strs.stream()
|
||||
.map(TypeDesc::decodeString)
|
||||
.collect(Collectors.toList());
|
||||
.toList();
|
||||
}
|
||||
|
||||
private static List<PubApiTypeParam> parseTypeParams(List<String> strs) {
|
||||
return strs.stream().map(PubApi::parseTypeParam).collect(Collectors.toList());
|
||||
return strs.stream().map(PubApi::parseTypeParam).toList();
|
||||
}
|
||||
|
||||
// Parse a type parameter string. Example input:
|
||||
|
||||
@ -284,12 +284,12 @@ public abstract class JavadocHelper implements AutoCloseable {
|
||||
executableElement.getParameters()
|
||||
.stream()
|
||||
.map(param -> param.getSimpleName().toString())
|
||||
.collect(Collectors.toList());
|
||||
.toList();
|
||||
List<String> throwsList =
|
||||
executableElement.getThrownTypes()
|
||||
.stream()
|
||||
.map(TypeMirror::toString)
|
||||
.collect(Collectors.toList());
|
||||
.toList();
|
||||
Set<String> missingParams = new HashSet<>(parameters);
|
||||
Set<String> missingThrows = new HashSet<>(throwsList);
|
||||
boolean hasReturn = false;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user