Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -97,14 +97,16 @@ public class SearchModuleDependency implements org.netbeans.modules.java.hints.s
public SearchModuleDependency() {
}

private static final Set<String> CODES = Set.of(
"compiler.err.cant.resolve",//NOI18N
"compiler.err.cant.resolve.location",//NOI18N
"compiler.err.doesnt.exist",//NOI18N
"compiler.err.not.stmt"
);//NOI18N

@Override
public Set<String> getCodes() {
return new HashSet<String>(Arrays.asList(
"compiler.err.cant.resolve",//NOI18N
"compiler.err.cant.resolve.location",//NOI18N
"compiler.err.doesnt.exist",//NOI18N
"compiler.err.not.stmt"));//NOI18N

return CODES;
}

private boolean isHintEnabled() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ public void run() {
}

private void addExtCluster(ClusterInfo ci) {
Set<String> disabledModuleCNB = new HashSet<String>(Arrays.asList(getProperties().getDisabledModules()));
Set<String> disabledModuleCNB = Set.of(getProperties().getDisabledModules());
Children.SortedArray moduleCh = new Children.SortedArray();
try {
ModuleList ml = ModuleList.scanCluster(ci.getClusterDir(), null, false, ci);
Expand All @@ -274,7 +274,7 @@ private ClusterNode createSuiteNode(ClusterInfo ci) {
assert ci.getProject() != null;
assert ci.getProject().getLookup().lookup(SuiteProvider.class) != null;

Set<String> disabledModuleCNB = new HashSet<String>(Arrays.asList(getProperties().getDisabledModules()));
Set<String> disabledModuleCNB = Set.of(getProperties().getDisabledModules());
Children.SortedArray moduleCh = new Children.SortedArray();
moduleCh.setComparator(MODULES_COMPARATOR);
Set<NbModuleProject> modules = SuiteUtils.getSubProjects(ci.getProject());
Expand Down Expand Up @@ -313,8 +313,8 @@ private void refreshModules() {
// create platform modules children first
platformModules = plaf.getSortedModules();
initNodes();
Set<String> disabledModuleCNB = new HashSet<String>(Arrays.asList(getProperties().getDisabledModules()));
Set<String> enabledClusters = new HashSet<String>(Arrays.asList(getProperties().getEnabledClusters()));
Set<String> disabledModuleCNB = Set.of(getProperties().getDisabledModules());
Set<String> enabledClusters = Set.of(getProperties().getEnabledClusters());

Map<File, ClusterNode> clusterToNode = new HashMap<File, ClusterNode>();
synchronized (libChildren.platformNodes) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -631,10 +631,10 @@ public void testMasks() throws Exception {
}
}
assertEquals("#63295: masks work",
new HashSet<String>(Arrays.asList(
"org-netbeans-modules-options-OptionsWindowAction.shadow"
// org-netbeans-core-actions-OptionsAction.instance should be masked
)), optionInstanceNames);
Set.of(
"org-netbeans-modules-options-OptionsWindowAction.shadow"
// org-netbeans-core-actions-OptionsAction.instance should be masked
), optionInstanceNames);
// catalogs registered by annotation
// assertNotNull("system FS has xml/catalog", fs.findResource("Services/Hidden/CatalogProvider/org-netbeans-modules-xml-catalog-impl-XCatalogProvider.instance"));
assertNull("but one entry hidden by apisupport/project", fs.findResource("Services/Hidden/org-netbeans-modules-xml-catalog-impl-SystemCatalogProvider.instance"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;

import org.netbeans.api.project.ProjectInformation;
import org.netbeans.api.project.ProjectManager;
import org.netbeans.api.project.ProjectUtils;
Expand Down Expand Up @@ -76,7 +78,7 @@ public void testProjectInformation() throws Exception {
ep.setProperty("app.name", "sweetness");
ep.setProperty("app.title", "Sweetness is Now!");
p.getHelper().putProperties(AntProjectHelper.PROJECT_PROPERTIES_PATH, ep);
assertEquals(new HashSet<String>(Arrays.asList(ProjectInformation.PROP_NAME, ProjectInformation.PROP_DISPLAY_NAME)), l.changed);
assertEquals(Set.of(ProjectInformation.PROP_NAME, ProjectInformation.PROP_DISPLAY_NAME), l.changed);
assertEquals("Sweet_Stuff", i.getName());
assertEquals("Sweetness is Now!", i.getDisplayName());
model = new SuiteBrandingModel(new SuiteProperties(p, p.getHelper(), p.getEvaluator(), Collections.<NbModuleProject>emptySet()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public void testNameAndDisplayName() throws Exception {
ep.setProperty("app.title", "Sweetness is Now!");
p.getHelper().putProperties(AntProjectHelper.PROJECT_PROPERTIES_PATH, ep);
TestBase.waitForNodesUpdate();
assertEquals(new HashSet<String>(Arrays.asList(Node.PROP_NAME, Node.PROP_DISPLAY_NAME)), nl.changed);
assertEquals(Set.of(Node.PROP_NAME, Node.PROP_DISPLAY_NAME), nl.changed);
assertEquals("Sweetness is Now!", n.getName());
assertEquals("Sweetness is Now!", n.getDisplayName());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ private void assertMatches(String text, String[] cnbs) {
for (ModuleDependency dep : filter.getMatches(null, text, false)) {
matchedCNBs.add(dep.getModuleEntry().getCodeNameBase());
}
assertEquals("correct matches for '" + text + "'", new HashSet<String>(Arrays.asList(cnbs)), matchedCNBs);
assertEquals("correct matches for '" + text + "'", Set.of(cnbs), matchedCNBs);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;

import org.netbeans.junit.NbTestCase;

/**
Expand Down Expand Up @@ -125,21 +127,21 @@ public void testReadGeneral() throws Exception {
assertEquals(Collections.EMPTY_SET, m.getAttributeNames(null));
assertEquals(Collections.EMPTY_SET, m.getSectionNames());
m = string2Manifest("Foo: val1\nBar: val2");
assertEquals(new HashSet<String>(Arrays.asList("Foo", "Bar")), m.getAttributeNames(null));
assertEquals(Set.of("Foo", "Bar"), m.getAttributeNames(null));
assertEquals("val1", m.getAttribute("Foo", null));
assertEquals("val2", m.getAttribute("Bar", null));
assertEquals(Collections.emptySet(), m.getSectionNames());
m = string2Manifest("Foo: val1\nBar: val2\n\nName: something.class\nAttr: val\n\nName: other.class\nAttr: val2\n\n");
assertEquals(new HashSet<String>(Arrays.asList("Foo", "Bar")), m.getAttributeNames(null));
assertEquals(Set.of("Foo", "Bar"), m.getAttributeNames(null));
assertEquals("val1", m.getAttribute("foo", null));
assertEquals("val2", m.getAttribute("bar", null));
assertEquals(new HashSet<String>(Arrays.asList("something.class", "other.class")), m.getSectionNames());
assertEquals(Set.of("something.class", "other.class"), m.getSectionNames());
assertEquals(Collections.singleton("Attr"), m.getAttributeNames("something.class"));
assertEquals("val", m.getAttribute("Attr", "something.class"));
assertEquals(Collections.singleton("Attr"), m.getAttributeNames("other.class"));
assertEquals("val2", m.getAttribute("Attr", "other.class"));
m = string2Manifest("Foo : bar \nBaz:quux");
assertEquals(new HashSet<String>(Arrays.asList("Foo", "Baz")), m.getAttributeNames(null));
assertEquals(Set.of("Foo", "Baz"), m.getAttributeNames(null));
assertEquals("bar ", m.getAttribute("Foo", null));
assertEquals("quux", m.getAttribute("Baz", null));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ public void testSimpleAttributeReads() throws Exception {
FileSystem fs = new Layer("<file name='x'><attr name='a' stringvalue='v'/> <attr name='b' urlvalue='file:/nothing'/></file> " +
"<folder name='y'> <file name='ignore'/><attr name='a' boolvalue='true'/><!--ignore--></folder>").read();
FileObject x = fs.findResource("x");
assertEquals(new HashSet<String>(Arrays.asList("a", "b")), new HashSet<String>(Collections.list(x.getAttributes())));
assertEquals(Set.of("a", "b"), Set.of(Collections.list(x.getAttributes())));
assertEquals("v", x.getAttribute("a"));
assertEquals(new URL("file:/nothing"), x.getAttribute("b"));
assertEquals(null, x.getAttribute("dummy"));
Expand Down Expand Up @@ -613,9 +613,7 @@ public void testStructuralModificationsFired() throws Exception {
FileUtil.createData(fs.getRoot(), "a");
FileUtil.createData(fs.getRoot(), "f/b");
fs.findResource("x").delete();
assertEquals("expected things fired",
new HashSet<String>(Arrays.asList("a", "f/b", "x")),
fcl.changes());
assertEquals("expected things fired", Set.of("a", "f/b", "x"), fcl.changes());
}

@RandomlyFails // issue #237349
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ final class FileRecognitionPanel extends BasicWizardIterator.Panel {
private static final Pattern EXTENSION_PATTERN = Pattern.compile("([.]?[a-zA-Z0-9_]+){1}([ ,]+[.]?[a-zA-Z0-9_]+)*[ ]*"); // NOI18N
private static final Pattern ELEMENT_PATTERN = Pattern.compile("(application/([a-zA-Z0-9_.-])*\\+xml|text/([a-zA-Z0-9_.-])*\\+xml)"); // NOI18N
private static final Pattern REG_NAME_PATTERN = Pattern.compile("^[[\\p{Alnum}][!#$&.+\\-^_]]{1,127}$"); //NOI18N
private static final Set<String> WELL_KNOWN_TYPES = new HashSet<String>(Arrays.asList(
private static final Set<String> WELL_KNOWN_TYPES = Set.of(
"application", //NOI18N
"audio", //NOI18N
"content", //NOI18N for content/unknown mime type
Expand All @@ -55,7 +55,7 @@ final class FileRecognitionPanel extends BasicWizardIterator.Panel {
"multipart", //NOI18N
"text", //NOI18N
"video" //NOI18N
));
);

private NewLoaderIterator.DataModel data;
private ButtonGroup group;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,12 @@ public class NbmActionGoalProvider implements MavenActionsProvider {
}
};

private static final Set<String> SUPPORTED_ACTIONS = Set.of(NBMRELOAD, RELOAD_TARGET);

public @Override Set<String> getSupportedDefaultActions() {
return new HashSet<String>(Arrays.asList(NBMRELOAD, RELOAD_TARGET));
return SUPPORTED_ACTIONS;
}



@ActionID(id = "org.netbeans.modules.maven.apisupport.NBMReload", category = "Project")
@ActionRegistration(displayName = "#ACT_NBM_Reload", lazy=false)
@ActionReference(position = 1250, path = "Projects/org-netbeans-modules-maven/Actions")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,11 @@ public boolean isToolSupported(String toolName) {
return false;
}

private static final Set<String> SUPPORTED_PLATFORMS = Set.of("1.6","1.5");

@Override
public Set getSupportedJavaPlatformVersions() {
return new HashSet<String>(Arrays.asList(new String[] {"1.6","1.5"}));
return SUPPORTED_PLATFORMS;
}

@Override
Expand Down
Loading