8284026: Use unmodifiable collections where practical
Reviewed-by: jjg
This commit is contained in:
parent
77a205aa4c
commit
73cb922bfc
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2012, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2012, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -26,9 +26,9 @@
|
||||
package jdk.javadoc.internal.api;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import javax.tools.DocumentationTool.DocumentationTask;
|
||||
@ -67,9 +67,9 @@ public class JavadocTaskImpl implements DocumentationTask {
|
||||
this.context = context;
|
||||
this.docletClass = docletClass;
|
||||
|
||||
this.options = (options == null) ? Collections.emptySet()
|
||||
this.options = (options == null) ? Set.of()
|
||||
: nullCheck(options);
|
||||
this.fileObjects = (fileObjects == null) ? Collections.emptySet()
|
||||
this.fileObjects = (fileObjects == null) ? Set.of()
|
||||
: nullCheck(fileObjects);
|
||||
setLocale(Locale.getDefault());
|
||||
}
|
||||
|
@ -27,7 +27,6 @@ package jdk.javadoc.internal.doclets.formats.html;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.SortedSet;
|
||||
@ -68,10 +67,6 @@ import jdk.javadoc.internal.doclets.toolkit.util.VisibleMemberTable;
|
||||
* deletion without notice.</b>
|
||||
*
|
||||
* @see javax.lang.model.element.TypeElement
|
||||
* @see java.util.Collections
|
||||
* @see java.util.List
|
||||
* @see java.util.ArrayList
|
||||
* @see java.util.HashMap
|
||||
*/
|
||||
public class ClassWriterImpl extends SubWriterHolderWriter implements ClassWriter {
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2017, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -52,7 +52,6 @@ import javax.tools.JavaFileManager.Location;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import jdk.javadoc.internal.doclets.formats.html.Navigation.PageMode;
|
||||
@ -213,7 +212,7 @@ public class DocFilesHandlerImpl implements DocFilesHandler {
|
||||
.setHeader(docletWriter.getHeader(PageMode.DOC_FILE, element))
|
||||
.addMainContent(pageContent)
|
||||
.setFooter(docletWriter.getFooter()));
|
||||
docletWriter.printHtmlDocument(Collections.emptyList(), null, localTagsContent, Collections.emptyList(), htmlContent);
|
||||
docletWriter.printHtmlDocument(List.of(), null, localTagsContent, List.of(), htmlContent);
|
||||
}
|
||||
|
||||
|
||||
|
@ -26,7 +26,6 @@
|
||||
package jdk.javadoc.internal.doclets.formats.html;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.EnumSet;
|
||||
import java.util.HashMap;
|
||||
@ -411,7 +410,7 @@ public class HtmlDocletWriter {
|
||||
String description,
|
||||
Content body)
|
||||
throws DocFileIOException {
|
||||
printHtmlDocument(metakeywords, description, new ContentBuilder(), Collections.emptyList(), body);
|
||||
printHtmlDocument(metakeywords, description, new ContentBuilder(), List.of(), body);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -25,7 +25,7 @@
|
||||
|
||||
package jdk.javadoc.internal.doclets.formats.html;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.Head;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder;
|
||||
@ -78,7 +78,7 @@ public class IndexRedirectWriter extends HtmlDocletWriter {
|
||||
.setTimestamp(!options.noTimestamp())
|
||||
.setDescription("index redirect")
|
||||
.setGenerator(getGenerator(getClass()))
|
||||
.setStylesheets(configuration.getMainStylesheet(), Collections.emptyList()) // avoid reference to default stylesheet
|
||||
.setStylesheets(configuration.getMainStylesheet(), List.of()) // avoid reference to default stylesheet
|
||||
.addDefaultScript(false);
|
||||
|
||||
String title = (options.windowTitle().length() > 0)
|
||||
|
@ -26,7 +26,6 @@
|
||||
package jdk.javadoc.internal.doclets.formats.html;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
@ -264,11 +263,11 @@ public class ModuleWriterImpl extends HtmlDocletWriter implements ModuleSummaryW
|
||||
});
|
||||
|
||||
// Get all packages if module is open or if displaying concealed modules
|
||||
for (PackageElement pkg : utils.getModulePackageMap().getOrDefault(mdle, Collections.emptySet())) {
|
||||
for (PackageElement pkg : utils.getModulePackageMap().getOrDefault(mdle, Set.of())) {
|
||||
if (shouldDocument(pkg) && (mdle.isOpen() || moduleMode == ModuleMode.ALL)) {
|
||||
PackageEntry e = new PackageEntry();
|
||||
if (mdle.isOpen()) {
|
||||
e.openedTo = Collections.emptySet();
|
||||
e.openedTo = Set.of();
|
||||
}
|
||||
packages.put(pkg, e);
|
||||
}
|
||||
@ -329,7 +328,7 @@ public class ModuleWriterImpl extends HtmlDocletWriter implements ModuleSummaryW
|
||||
}
|
||||
SortedSet<PackageElement> openPackages = new TreeSet<>(utils.comparators.makePackageComparator());
|
||||
if (module.isOpen()) {
|
||||
openPackages.addAll(utils.getModulePackageMap().getOrDefault(module, Collections.emptySet()));
|
||||
openPackages.addAll(utils.getModulePackageMap().getOrDefault(module, Set.of()));
|
||||
} else {
|
||||
ElementFilter.opensIn(module.getDirectives()).forEach(directive -> {
|
||||
PackageElement pkg = directive.getPackage();
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2020, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2020, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -46,7 +46,6 @@ import javax.lang.model.element.TypeElement;
|
||||
import javax.lang.model.type.TypeMirror;
|
||||
import javax.lang.model.util.ElementKindVisitor14;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.SortedSet;
|
||||
@ -106,7 +105,7 @@ public class Signatures {
|
||||
private final HtmlConfiguration configuration;
|
||||
private Content modifiers;
|
||||
|
||||
private static final Set<String> previewModifiers = Collections.emptySet();
|
||||
private static final Set<String> previewModifiers = Set.of();
|
||||
|
||||
TypeSignature(TypeElement typeElement, HtmlDocletWriter writer) {
|
||||
this.typeElement = typeElement;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -28,7 +28,6 @@ package jdk.javadoc.internal.doclets.formats.html.markup;
|
||||
import java.io.IOException;
|
||||
import java.io.Writer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
@ -38,7 +37,7 @@ import jdk.javadoc.internal.doclets.toolkit.Content;
|
||||
* A sequence of Content nodes.
|
||||
*/
|
||||
public class ContentBuilder extends Content {
|
||||
protected List<Content> contents = Collections.emptyList();
|
||||
protected List<Content> contents = List.of();
|
||||
|
||||
public ContentBuilder() { }
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -31,7 +31,6 @@ import java.time.ZonedDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
@ -61,12 +60,12 @@ public class Head extends Content {
|
||||
private String generator;
|
||||
private boolean showTimestamp;
|
||||
private DocPath mainStylesheet;
|
||||
private List<DocPath> additionalStylesheets = Collections.emptyList();
|
||||
private List<DocPath> additionalStylesheets = List.of();
|
||||
private boolean index;
|
||||
private Script mainBodyScript;
|
||||
private final List<Script> scripts;
|
||||
// Scripts added via --add-script option
|
||||
private List<DocPath> additionalScripts = Collections.emptyList();
|
||||
private List<DocPath> additionalScripts = List.of();
|
||||
private final List<Content> extraContent;
|
||||
private boolean addDefaultScript = true;
|
||||
private DocPath canonicalLink;
|
||||
|
@ -347,7 +347,7 @@ public abstract class BaseConfiguration {
|
||||
}
|
||||
|
||||
// add entries for modules which may not have exported packages
|
||||
modules.forEach(mdle -> modulePackages.computeIfAbsent(mdle, m -> Collections.emptySet()));
|
||||
modules.forEach(mdle -> modulePackages.computeIfAbsent(mdle, m -> Set.of()));
|
||||
|
||||
modules.addAll(modulePackages.keySet());
|
||||
showModules = !modules.isEmpty();
|
||||
|
@ -40,7 +40,6 @@ import java.time.temporal.TemporalUnit;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Calendar;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
@ -1028,7 +1027,7 @@ public abstract class BaseOptions {
|
||||
* Arguments for command line option {@code --since}.
|
||||
*/
|
||||
public List<String> since() {
|
||||
return Collections.unmodifiableList(since);
|
||||
return List.copyOf(since);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2001, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -29,7 +29,6 @@ import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.PrintStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.EnumMap;
|
||||
import java.util.EnumSet;
|
||||
import java.util.HashSet;
|
||||
@ -234,7 +233,7 @@ public class TagletManager {
|
||||
}
|
||||
sfm.setLocation(TAGLET_PATH, paths);
|
||||
} else if (!sfm.hasLocation(TAGLET_PATH)) {
|
||||
sfm.setLocation(TAGLET_PATH, Collections.emptyList());
|
||||
sfm.setLocation(TAGLET_PATH, List.of());
|
||||
}
|
||||
} else if (tagletPath != null) {
|
||||
messages.error("doclet.not_standard_file_manager");
|
||||
|
@ -25,7 +25,6 @@
|
||||
|
||||
package jdk.javadoc.internal.doclets.toolkit.taglets;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.EnumSet;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
@ -35,7 +34,6 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.lang.model.element.Element;
|
||||
import javax.lang.model.element.ExecutableElement;
|
||||
@ -251,6 +249,6 @@ public class ThrowsTaglet extends BaseTaglet
|
||||
}
|
||||
return map;
|
||||
}
|
||||
return Collections.emptyMap();
|
||||
return Map.of();
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -26,7 +26,6 @@
|
||||
package jdk.javadoc.internal.doclets.toolkit.util;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@ -677,7 +676,7 @@ public class CommentHelper {
|
||||
|
||||
@Override
|
||||
protected List<? extends DocTree> defaultAction(DocTree node, Void p) {
|
||||
return Collections.emptyList();
|
||||
return List.of();
|
||||
}
|
||||
}.visit(dtree, null);
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -197,7 +197,7 @@ public class DocFinder {
|
||||
/**
|
||||
* The inherited documentation.
|
||||
*/
|
||||
public List<? extends DocTree> inlineTags = Collections.emptyList();
|
||||
public List<? extends DocTree> inlineTags = List.of();
|
||||
|
||||
/**
|
||||
* False if documentation could not be inherited.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2002, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -117,9 +117,9 @@ public class MetaKeywords {
|
||||
*/
|
||||
public List<String> getMetaKeywordsForModule(ModuleElement mdle) {
|
||||
if (options.keywords()) {
|
||||
return Arrays.asList(mdle.getQualifiedName() + " " + "module");
|
||||
return List.of(mdle.getQualifiedName() + " " + "module");
|
||||
} else {
|
||||
return Collections.emptyList();
|
||||
return List.of();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -35,7 +35,6 @@ import java.text.RuleBasedCollator;
|
||||
import java.util.ArrayDeque;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Deque;
|
||||
import java.util.EnumSet;
|
||||
import java.util.HashMap;
|
||||
@ -643,7 +642,7 @@ public class Utils {
|
||||
if (!bounds.isEmpty()) {
|
||||
TypeMirror upperBound = bounds.get(bounds.size() - 1);
|
||||
if (ignoreBounds(upperBound)) {
|
||||
return Collections.emptyList();
|
||||
return List.of();
|
||||
}
|
||||
}
|
||||
return bounds;
|
||||
@ -764,7 +763,7 @@ public class Utils {
|
||||
}
|
||||
|
||||
public TypeMirror getDeclaredType(TypeElement enclosing, TypeMirror target) {
|
||||
return getDeclaredType(Collections.emptyList(), enclosing, target);
|
||||
return getDeclaredType(List.of(), enclosing, target);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2261,7 +2260,7 @@ public class Utils {
|
||||
}
|
||||
|
||||
public List<? extends DocTree> getBlockTags(DocCommentTree dcTree) {
|
||||
return dcTree == null ? Collections.emptyList() : dcTree.getBlockTags();
|
||||
return dcTree == null ? List.of() : dcTree.getBlockTags();
|
||||
}
|
||||
|
||||
public List<? extends DocTree> getBlockTags(Element element, Predicate<DocTree> filter) {
|
||||
@ -2480,21 +2479,21 @@ public class Utils {
|
||||
public List<? extends DocTree> getPreamble(Element element) {
|
||||
DocCommentTree docCommentTree = getDocCommentTree(element);
|
||||
return docCommentTree == null
|
||||
? Collections.emptyList()
|
||||
? List.of()
|
||||
: docCommentTree.getPreamble();
|
||||
}
|
||||
|
||||
public List<? extends DocTree> getFullBody(Element element) {
|
||||
DocCommentTree docCommentTree = getDocCommentTree(element);
|
||||
return (docCommentTree == null)
|
||||
? Collections.emptyList()
|
||||
? List.of()
|
||||
: docCommentTree.getFullBody();
|
||||
}
|
||||
|
||||
public List<? extends DocTree> getBody(Element element) {
|
||||
DocCommentTree docCommentTree = getDocCommentTree(element);
|
||||
return (docCommentTree == null)
|
||||
? Collections.emptyList()
|
||||
? List.of()
|
||||
: docCommentTree.getFullBody();
|
||||
}
|
||||
|
||||
@ -2549,7 +2548,7 @@ public class Utils {
|
||||
public List<? extends DocTree> getFirstSentenceTrees(Element element) {
|
||||
DocCommentTree dcTree = getDocCommentTree(element);
|
||||
if (dcTree == null) {
|
||||
return Collections.emptyList();
|
||||
return List.of();
|
||||
}
|
||||
return new ArrayList<>(dcTree.getFirstSentence());
|
||||
}
|
||||
@ -2649,7 +2648,7 @@ public class Utils {
|
||||
public PreviewSummary declaredUsingPreviewAPIs(Element el) {
|
||||
if (el.asType().getKind() == ERROR) {
|
||||
// Can happen with undocumented --ignore-source-errors option
|
||||
return new PreviewSummary(Collections.emptySet(), Collections.emptySet(), Collections.emptySet());
|
||||
return new PreviewSummary(Set.of(), Set.of(), Set.of());
|
||||
}
|
||||
List<TypeElement> usedInDeclaration = new ArrayList<>(annotations2Classes(el));
|
||||
switch (el.getKind()) {
|
||||
|
@ -221,7 +221,7 @@ public class VisibleMemberTable {
|
||||
*/
|
||||
public List<Element> getAllVisibleMembers(Kind kind) {
|
||||
ensureInitialized();
|
||||
return visibleMembers.getOrDefault(kind, Collections.emptyList());
|
||||
return visibleMembers.getOrDefault(kind, List.of());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -234,7 +234,7 @@ public class VisibleMemberTable {
|
||||
public List<Element> getVisibleMembers(Kind kind, Predicate<Element> p) {
|
||||
ensureInitialized();
|
||||
|
||||
return visibleMembers.getOrDefault(kind, Collections.emptyList()).stream()
|
||||
return visibleMembers.getOrDefault(kind, List.of()).stream()
|
||||
.filter(p)
|
||||
.toList();
|
||||
}
|
||||
@ -799,10 +799,10 @@ public class VisibleMemberTable {
|
||||
// Freeze the data structures
|
||||
for (Kind kind : Kind.values()) {
|
||||
orderedMembers.computeIfPresent(kind, (k, v) -> Collections.unmodifiableList(v));
|
||||
orderedMembers.computeIfAbsent(kind, t -> Collections.emptyList());
|
||||
orderedMembers.computeIfAbsent(kind, t -> List.of());
|
||||
|
||||
memberMap.computeIfPresent(kind, (k, v) -> Collections.unmodifiableMap(v));
|
||||
memberMap.computeIfAbsent(kind, t -> Collections.emptyMap());
|
||||
memberMap.computeIfAbsent(kind, t -> Map.of());
|
||||
}
|
||||
}
|
||||
|
||||
@ -840,12 +840,12 @@ public class VisibleMemberTable {
|
||||
|
||||
List<Element> getMembers(String key, Kind kind) {
|
||||
Map<String, List<Element>> map = memberMap.get(kind);
|
||||
return map.getOrDefault(key, Collections.emptyList());
|
||||
return map.getOrDefault(key, List.of());
|
||||
}
|
||||
|
||||
<T extends Element> List<T> getMembers(String key, Kind kind, Class<T> clazz) {
|
||||
Map<String, List<Element>> map = memberMap.get(kind);
|
||||
return map.getOrDefault(key, Collections.emptyList())
|
||||
return map.getOrDefault(key, List.of())
|
||||
.stream()
|
||||
.map(clazz::cast)
|
||||
.toList();
|
||||
@ -901,7 +901,7 @@ public class VisibleMemberTable {
|
||||
return;
|
||||
|
||||
PropertyUtils pUtils = config.propertyUtils;
|
||||
List<Element> list = visibleMembers.getOrDefault(Kind.METHODS, Collections.emptyList())
|
||||
List<Element> list = visibleMembers.getOrDefault(Kind.METHODS, List.of())
|
||||
.stream()
|
||||
.filter(e -> pUtils.isPropertyMethod((ExecutableElement) e))
|
||||
.toList();
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2012, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2012, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -362,7 +362,7 @@ public class Env {
|
||||
|
||||
}
|
||||
}
|
||||
return Collections.emptyList();
|
||||
return List.of();
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2010, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2010, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -25,7 +25,6 @@
|
||||
|
||||
package jdk.javadoc.internal.doclint;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.EnumMap;
|
||||
import java.util.EnumSet;
|
||||
import java.util.HashMap;
|
||||
@ -554,11 +553,11 @@ public enum HtmlTag {
|
||||
private final Map<Attr,AttrKind> attrs;
|
||||
|
||||
HtmlTag(BlockType blockType, EndKind endKind, AttrMap... attrMaps) {
|
||||
this(ElemKind.OK, blockType, endKind, Collections.emptySet(), attrMaps);
|
||||
this(ElemKind.OK, blockType, endKind, Set.of(), attrMaps);
|
||||
}
|
||||
|
||||
HtmlTag(ElemKind elemKind, BlockType blockType, EndKind endKind, AttrMap... attrMaps) {
|
||||
this(elemKind, blockType, endKind, Collections.emptySet(), attrMaps);
|
||||
this(elemKind, blockType, endKind, Set.of(), attrMaps);
|
||||
}
|
||||
|
||||
HtmlTag(BlockType blockType, EndKind endKind, Set<Flag> flags, AttrMap... attrMaps) {
|
||||
|
@ -185,8 +185,8 @@ public class ElementsTable {
|
||||
private Set<ModulePackage> excludePackages = new LinkedHashSet<>();
|
||||
private Set<ModulePackage> subPackages = new LinkedHashSet<>();
|
||||
|
||||
private List<JCClassDecl> classDecList = Collections.emptyList();
|
||||
private List<String> classArgList = Collections.emptyList();
|
||||
private List<JCClassDecl> classDecList = List.of();
|
||||
private List<String> classArgList = List.of();
|
||||
private com.sun.tools.javac.util.List<JCCompilationUnit> classTreeList = null;
|
||||
|
||||
private final Set<JavaFileObject.Kind> sourceKinds = EnumSet.of(JavaFileObject.Kind.SOURCE);
|
||||
@ -837,7 +837,7 @@ public class ElementsTable {
|
||||
ListBuffer<JavaFileObject> lb = new ListBuffer<>();
|
||||
List<Location> locs = getLocation(modpkg);
|
||||
if (locs.isEmpty()) {
|
||||
return Collections.emptyList();
|
||||
return List.of();
|
||||
}
|
||||
String pname = modpkg.packageName;
|
||||
for (Location packageLocn : locs) {
|
||||
@ -865,7 +865,7 @@ public class ElementsTable {
|
||||
|
||||
private List<Location> getLocation(ModulePackage modpkg) throws ToolException {
|
||||
if (locations.size() == 1 && !locations.contains(StandardLocation.MODULE_SOURCE_PATH)) {
|
||||
return Collections.singletonList(locations.get(0));
|
||||
return List.of(locations.get(0));
|
||||
}
|
||||
|
||||
if (modpkg.hasModule()) {
|
||||
@ -874,7 +874,7 @@ public class ElementsTable {
|
||||
// TODO: handle invalid results better.
|
||||
ModuleSymbol msym = findModuleOfPackageName(modpkg.packageName);
|
||||
if (msym == null) {
|
||||
return Collections.emptyList();
|
||||
return List.of();
|
||||
}
|
||||
return getModuleLocation(locations, msym.name.toString());
|
||||
}
|
||||
|
@ -31,7 +31,6 @@ import java.io.PrintWriter;
|
||||
import java.text.BreakIterator;
|
||||
import java.text.Collator;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.IllformedLocaleException;
|
||||
import java.util.List;
|
||||
@ -349,7 +348,7 @@ public class Start {
|
||||
error("main.cant.read", e.getMessage());
|
||||
return ERROR;
|
||||
}
|
||||
return begin(allArgs, Collections.emptySet());
|
||||
return begin(allArgs, Set.of());
|
||||
}
|
||||
|
||||
// Called by the JSR 199 API
|
||||
@ -638,7 +637,7 @@ public class Start {
|
||||
text = log.getText("main.unnecessary_arg_provided", argBase);
|
||||
throw new OptionException(ERROR, this::showUsage, text);
|
||||
case 1:
|
||||
if (!opt.process(arg, Collections.singletonList(argVal))) {
|
||||
if (!opt.process(arg, List.of(argVal))) {
|
||||
m = -1;
|
||||
}
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user