Skip to content

Commit

Permalink
[NETBEANS-3449] remove warning related to use of EMPTY_SET
Browse files Browse the repository at this point in the history
There are places where the following warning pops up..

   [repeat] /home/bwalker/src/netbeans/ide/spi.debugger.ui/src/org/netbeans/modules/debugger/ui/views/debugging/DebuggingViewComponent.java:782: warning: [unchecked] unchecked conversion
   [repeat]                             deadlockedThreads = Collections.EMPTY_SET;
   [repeat]                                                            ^
   [repeat]   required: Set<DVThread>
   [repeat]   found:    Set

This change removes all instances of this warning.. Usually it's difficult for me to remove a whole class of warnings.. This makes me happy..
  • Loading branch information
BradWalker committed Nov 25, 2019
1 parent f089b59 commit a77e841
Show file tree
Hide file tree
Showing 34 changed files with 46 additions and 48 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ protected void addNotify() {

@Override
protected void removeNotify() {
setKeys(Collections.EMPTY_SET);
setKeys(Collections.emptySet());
}

private void refreshList() {
Expand Down Expand Up @@ -533,7 +533,7 @@ protected void addNotify() {

@Override
protected void removeNotify() {
setKeys(Collections.EMPTY_SET);
setKeys(Collections.emptySet());
}

private void refreshList() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ protected void addNotify() {

@Override
protected void removeNotify() {
setKeys(Collections.EMPTY_SET);
setKeys(Collections.emptySet());
}

private void refreshList() {
Expand Down Expand Up @@ -498,7 +498,7 @@ protected void addNotify() {

@Override
protected void removeNotify() {
setKeys(Collections.EMPTY_SET);
setKeys(Collections.emptySet());
}

private void refreshList() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public Set<MessageDestination> getMessageDestinations() throws ConfigurationExce
// TODO : need to account for a remote domain here?
return readMessageDestinations(domainXml, "/domain/", null);
} else {
return Collections.EMPTY_SET;
return Collections.emptySet();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ public Set<Datasource> getDatasources() throws ConfigurationException {
return readDatasources(
domainXml, "/domain/", null, server.getVersion(), false);
} else {
return Collections.EMPTY_SET;
return Collections.emptySet();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ private WizardDescriptor.Panel[] getPanels() {

@Override
public Set instantiate() throws IOException {
Set result = Collections.EMPTY_SET;
Set result = Collections.emptySet();
WebLogicDDWizardPanel wizardPanel = (WebLogicDDWizardPanel) panels[0];

File configDir = wizardPanel.getSelectedLocation();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ private static Collection<EjbJar> getRelevantEjbModules(FileObject fo) {
if (emod != null) {
projects.add(affectedProject);
} else {
return Collections.EMPTY_SET;
return Collections.emptySet();
}
for (Project project : OpenProjects.getDefault().getOpenProjects()) {
Object isJ2eeApp = project.getLookup().lookup(J2eeApplicationProvider.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public Set<MessageDestination> getMessageDestinations() throws ConfigurationExce
// TODO : need to account for a remote domain here?
return readMessageDestinations(domainXml, "/domain/", null);
} else {
return Collections.EMPTY_SET;
return Collections.emptySet();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ public Set<Datasource> getDatasources() throws ConfigurationException {
return readDatasources(
domainXml, "/domain/", null, server.getVersion(), false);
} else {
return Collections.EMPTY_SET;
return Collections.emptySet();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ private void registerRepository() {
.stream()
.map(Repository::getId)
.collect(toSet())
: Collections.EMPTY_SET;
: Collections.emptySet();
for (org.apache.maven.model.Repository repository : sourceModel.getRepositories()) {
if (!existingRepositories.contains(repository.getId())) {
Repository repo = pomModel.getFactory().createRepository();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ protected void addNotify() {

@Override
protected void removeNotify() {
setKeys( Collections.EMPTY_SET );
setKeys( Collections.emptySet());
super.removeNotify();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ private static void loadJsfResourcesElementsHandles(CompilationController parame
}

public static Set extendJsfFramework(FileObject fileObject, boolean createWelcomeFile) {
Set result = Collections.EMPTY_SET;
Set result = Collections.emptySet();
if (fileObject == null) {
return result;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ protected void addNotify() {
}

protected void removeNotify() {
setKeys( Collections.EMPTY_SET );
setKeys( Collections.emptySet());
super.removeNotify();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ public static enum HIT_COUNT_FILTERING_STYLE { EQUAL, GREATER,
private String validityMessage;
private int hitCountFilter;
private HIT_COUNT_FILTERING_STYLE hitCountFilteringStyle;
private volatile Set<Breakpoint> breakpointsToEnable = Collections.EMPTY_SET;
private volatile Set<Breakpoint> breakpointsToDisable = Collections.EMPTY_SET;
private volatile Set<Breakpoint> breakpointsToEnable = Collections.emptySet();
private volatile Set<Breakpoint> breakpointsToDisable = Collections.emptySet();

{ pcs = new PropertyChangeSupport (this); }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ public DiffContentPanel(EditableDiffView master, boolean isFirst) {
editorPane.putClientProperty(DiffHighlightsLayerFactory.HIGHLITING_LAYER_ID, this);
if (!isFirst) {
// disable focus traversal, but permit just the up-cycle on ESC key
editorPane.setFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, Collections.EMPTY_SET);
editorPane.setFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, Collections.EMPTY_SET);
editorPane.setFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, Collections.emptySet());
editorPane.setFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, Collections.emptySet());
editorPane.setFocusTraversalKeys(KeyboardFocusManager.UP_CYCLE_TRAVERSAL_KEYS, Collections.singleton(
KeyStroke.getAWTKeyStroke(KeyEvent.VK_ESCAPE, InputEvent.SHIFT_DOWN_MASK)));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,8 @@ public void update() {
changed = false;
}

private Collection<String> updatedLangs = Collections.EMPTY_SET;

private Collection<String> legacyLangs = Collections.EMPTY_SET;
private Collection<String> updatedLangs = Collections.emptySet();
private Collection<String> legacyLangs = Collections.emptySet();

private void initLanguages() {
Set<String> mimeTypes = EditorSettings.getDefault().getAllMimeTypes();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ protected void addNotify() {
}

protected void removeNotify() {
setKeys(Collections.EMPTY_SET);
setKeys(Collections.emptySet());
super.removeNotify();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public LocalHistory() {

String rootPaths = System.getProperty("netbeans.localhistory.historypath");
if(rootPaths == null || rootPaths.trim().equals("")) {
userDefinedRoots = Collections.EMPTY_SET;
userDefinedRoots = Collections.emptySet();
} else {
String[] paths = rootPaths.split(";");
userDefinedRoots = new HashSet<String>(paths.length);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -673,7 +673,7 @@ private static void doCloseDebuggerUI() {
final Set<Component> initiallyOpenedMinimized;
if (componentsInitiallyOpened.isEmpty()) {
initiallyOpened = Collections.emptyList();
initiallyOpenedMinimized = Collections.EMPTY_SET;
initiallyOpenedMinimized = Collections.emptySet();
} else {
initiallyOpened = new ArrayList<Component>();
initiallyOpenedMinimized = new HashSet<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -779,7 +779,7 @@ public void run() {
// collect all deadlocked threads
Set<DVThread> deadlockedThreads;
if (deadlocks == null) {
deadlockedThreads = Collections.EMPTY_SET;
deadlockedThreads = Collections.emptySet();
} else {
deadlockedThreads = new HashSet<DVThread>();
for (Deadlock deadlock : deadlocks) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ protected void addNotify() {

@Override
protected void removeNotify() {
setKeys( Collections.EMPTY_SET );
setKeys( Collections.emptySet());
super.removeNotify();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public Collection<Long> loadCollapsedCommenst(String repoUrl, String id) {
l.release();
}

return Collections.EMPTY_SET;
return Collections.emptySet();
}

private Properties load(File file, String repoUrl, String id) throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public class ObservableSet<E> implements Set<E> {

private final PropertyChangeSupport pchs = new PropertyChangeSupport(this);

private Set<E> set = Collections.EMPTY_SET;
private Set<E> set = Collections.emptySet();

@Override
public int size() {
Expand Down Expand Up @@ -74,7 +74,7 @@ public <T> T[] toArray(T[] a) {

@Override
public boolean add(E e) {
if (set == Collections.EMPTY_SET) {
if (set == Collections.emptySet()) {
set = Collections.synchronizedSet(new HashSet<E>());
}
boolean added = set.add(e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ public void ok () {
breakpoint.setBreakpointsToDisable(createBreakpointsSet(breakpointsToDisableGroup));
/*
if (breakpointsToDisableGroup == null || breakpointsToDisableGroup == NONE_BREAKPOINT_GROUP) {
breakpoint.setBreakpointsToDisable(Collections.EMPTY_SET);
breakpoint.setBreakpointsToDisable(Collections.emptySet());
} else {
TestGroupProperties tgp = createTestProperties(breakpointsToDisableGroup);
if (tgp != null) {
Expand All @@ -318,7 +318,7 @@ public void ok () {
if (!customGroup.isEmpty()) {
breakpoint.setBreakpointsToDisable(new BreakpointsFromGroup(customGroup));
} else {
breakpoint.setBreakpointsToDisable(Collections.EMPTY_SET);
breakpoint.setBreakpointsToDisable(Collections.emptySet());
}
}
}
Expand All @@ -327,7 +327,7 @@ public void ok () {

private static Set<Breakpoint> createBreakpointsSet(Object selectedGroup) {
if (selectedGroup == null || selectedGroup == NONE_BREAKPOINT_GROUP) {
return Collections.EMPTY_SET;
return Collections.emptySet();
} else {
TestGroupProperties tgp = createTestProperties(selectedGroup);
if (tgp != null) {
Expand All @@ -338,7 +338,7 @@ private static Set<Breakpoint> createBreakpointsSet(Object selectedGroup) {
if (!customGroup.isEmpty()) {
return new BreakpointsFromGroup(customGroup);
} else {
return Collections.EMPTY_SET;
return Collections.emptySet();
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,9 @@ private void setExclusionPatterns () {
Set<String> patterns;
if (options.getBoolean("UseStepFilters", true)) {
patterns = (Set<String>) classFiltersProperties.getCollection (
"enabled",
Collections.EMPTY_SET);
"enabled", Collections.emptySet());
} else {
patterns = Collections.EMPTY_SET;
patterns = Collections.emptySet();
}
synchronized (filter) {
filter.clear();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ private static Set<Breakpoint> getBreakpointsFromGroup(Properties properties, St
if (bpGroup != null) {
return new BreakpointsFromGroup(new TestGroupProperties(bpGroup));
}
return Collections.EMPTY_SET;
return Collections.emptySet();
}

private static void setBreakpointsFromGroup(Properties properties, String base, Set<Breakpoint> breakpointsFromGroup) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ private boolean checkIssue224012(Project project) {
private Set<String> getDoNotIndexRepos() {
String st = System.getProperty("maven.indexing.doNotAutoIndex");
if(st == null || "".equals(st)) {
return Collections.EMPTY_SET;
return Collections.emptySet();
}
String[] repos = st.split(";");
return new HashSet<>(Arrays.asList(repos));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ private static Set<File> getUpdatedFiles() {
Set<File> clustersRootsList = getClustersRoots();

if (clustersRootsList == null || clustersRootsList.isEmpty()) {
return Collections.EMPTY_SET;
return Collections.emptySet();
}

FileFilter onlyXmlFilter = new FileFilter() {
Expand Down Expand Up @@ -165,7 +165,7 @@ public boolean accept(File file) {
};
clustersRoots = new HashSet<File>(Arrays.asList(installationLoc.listFiles(onlyDirFilter)));
} else {
clustersRoots = Collections.EMPTY_SET;
clustersRoots = Collections.emptySet();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public ElementKind getKind() {

@Override
public Set<Modifier> getModifiers() {
return Collections.EMPTY_SET;
return Collections.emptySet();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public int compare(Module o1, Module o2) {

private static Set<Module> findVisibleAncestor(Module module, Set<Module> seen) {
if (! seen.add(module)) {
return Collections.EMPTY_SET;
return Collections.emptySet();
}
Set<Module> visible = new HashSet<Module> ();
ModuleManager manager = module.getManager();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ public String toString() {
private final JButton cancelButton = new JButton();
private final JButton previousButton = new JButton();
private FinishAction finishOption;
private Set<Object> newObjects = Collections.EMPTY_SET;
private Set<Object> newObjects = Collections.emptySet();

/** a component with wait cursor */
private Component waitingComponent;
Expand Down Expand Up @@ -1529,7 +1529,7 @@ private void callInitialize() {
((InstantiatingIterator) data.getIterator(this)).initialize(this);
}

newObjects = Collections.EMPTY_SET;
newObjects = Collections.emptySet();
}

private void callUninitialize() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ private void update() {
MultiFileSystem mfs = getMultiFileSystem();
FileSystem[] arr = mfs.getDelegates();

Set now = (delegates == null) ? Collections.EMPTY_SET : delegates;
Set now = (delegates == null) ? Collections.emptySet(): delegates;
Set<FileObject> del = new HashSet<FileObject>(arr.length * 2);
Number maxWeight = 0;
FileObject led = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public JsElementImpl(FileObject fileObject, String name, boolean isDeclared,
LOG.log(Level.WARNING, "Suspicious offset range of element at \n", new Throwable());
}
this.offsetRange = offsetRange;
this.modifiers = modifiers == null ? Collections.EMPTY_SET: modifiers;
this.modifiers = modifiers == null ? Collections.emptySet(): modifiers;
this.isDeclared = isDeclared;
assert mimeType == null ||
isCorrectMimeType(mimeType) : mimeType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ public ElementKind getKind() {

@Override
public Set<Modifier> getModifiers() {
return Collections.EMPTY_SET;
return Collections.emptySet();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public ElementKind getKind() {

@Override
public Set<Modifier> getModifiers() {
return Collections.EMPTY_SET;
return Collections.emptySet();
}

@Override
Expand Down

0 comments on commit a77e841

Please sign in to comment.