Skip to content

Commit

Permalink
Merge pull request apache#2958 from BradWalker/cleanup_hashset_rawtype
Browse files Browse the repository at this point in the history
[NETBEANS-5683] - remove last remaining HashSet raw type warnings..
  • Loading branch information
BradWalker authored Jul 16, 2021
2 parents 40c79b9 + 444f854 commit c53f6b6
Show file tree
Hide file tree
Showing 11 changed files with 28 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,13 @@ public void propertyChange(PropertyChangeEvent evt) {
if (newTransitive == null) {
newTransitive = Collections.emptySet();
}
HashSet oldNotNew1 = new HashSet(oldPrivate);
Set<String> oldNotNew1 = new HashSet<>(oldPrivate);
oldNotNew1.removeAll(newPrivate);
HashSet newNotOld1 = new HashSet(newPrivate);
Set<String> newNotOld1 = new HashSet<>(newPrivate);
newNotOld1.removeAll(oldPrivate);
HashSet oldNotNew2 = new HashSet(oldTransitive);
Set<String> oldNotNew2 = new HashSet<>(oldTransitive);
oldNotNew2.removeAll(newTransitive);
HashSet newNotOld2 = new HashSet(newTransitive);
Set<String> newNotOld2 = new HashSet<>(newTransitive);
newNotOld2.removeAll(oldTransitive);

boolean privateChanged = !oldNotNew1.isEmpty() || !newNotOld1.isEmpty();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,13 @@ public File[] getToolClasspathEntries(String toolName) {
}

public Set getSupportedSpecVersions() {
Set result = new HashSet();
Set<String> result = new HashSet<>();
result.add(J2eeModule.J2EE_14);
return result;
}

public java.util.Set getSupportedModuleTypes() {
Set result = new HashSet();
public Set getSupportedModuleTypes() {
Set<Object> result = new HashSet<>();
// result.add(J2eeModule.EAR);
// result.add(J2eeModule.WAR);
result.add(J2eeModule.EJB);
Expand All @@ -68,7 +68,7 @@ public java.util.Set getSupportedModuleTypes() {
}

public Set/*<String>*/ getSupportedJavaPlatformVersions() {
Set versions = new HashSet();
Set<String> versions = new HashSet<>();
versions.add("1.4"); // NOI18N
versions.add("1.5"); // NOI18N
versions.add("1.6"); // NOI18N
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ public JSFFrameworkProvider() {
// not named extend() so as to avoid implementing WebFrameworkProvider.extend()
// better to move this to JSFConfigurationPanel
public Set extendImpl(WebModule webModule, TreeMap<String, JsfComponentCustomizer> jsfComponentCustomizers) {
Set result = new HashSet();
Set<FileObject> result = new HashSet<>();
Library jsfLibrary = null;
Library jstlLibrary = null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ public class WebServiceListModel {
private static Random serviceRandom = new Random(System.currentTimeMillis());
private static Random serviceGroupRandom = new Random(System.currentTimeMillis());
public boolean isDirty = false;
Set<WebServiceListModelListener> listeners = new HashSet<WebServiceListModelListener>();
Set<WebServiceListModelListener> listeners = new HashSet<>();

/**
* Fix for Bug#: 5039378
* Netbeans can potentially use multiple threads to maintain a Node's data model.
Expand All @@ -62,7 +63,7 @@ public class WebServiceListModel {
private List<WebServiceData> webServices = Collections.synchronizedList(new ArrayList<WebServiceData>());
private List<WebServiceGroup> webServiceGroups = Collections.synchronizedList(new ArrayList<WebServiceGroup>());
// To maintain the display names for the webservice/port
private Set<String> uniqueDisplayNames = Collections.synchronizedSet(new HashSet());
private Set<String> uniqueDisplayNames = Collections.synchronizedSet(new HashSet<String>());
private List<String> partnerServices = new ArrayList<String>();
private static WebServiceListModel websvcNodeModel = new WebServiceListModel();
private boolean initialized = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ public Set<HttpMethodType> getMethodTypes() {
}

public void setMethodTypes(HttpMethodType[] types) {
methodTypes = new HashSet(Arrays.asList(types));
methodTypes = new HashSet<>(Arrays.asList(types));
}

private String[] uriParams = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ public synchronized SourceGroup[] getSourceGroups(String type) {
ArrayList<SourceGroup> ret = new ArrayList<>();
Set<SourceType> stype = soureType2SourceType(type);
for (SourceType st : stype) {
Set<File> processed = new HashSet();
Set<File> processed = new HashSet<>();
for (String group : gradleSources.keySet()) {
Set<File> dirs = gradleSources.get(group).getSourceDirs(st);
boolean unique = dirs.size() == 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ private static boolean verifyCACertificatePath(Set<TrustAnchor> trustedCACertifi
}

private static boolean isChainTrusted(Collection<? extends Certificate> archiveCertificates, Collection<? extends Certificate> trustedCertificates) {
Collection<Certificate> c = new HashSet(trustedCertificates);
Collection<Certificate> c = new HashSet<>(trustedCertificates);
c.retainAll(archiveCertificates);
return ! c.isEmpty();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
import javax.swing.ActionMap;
import javax.swing.JComponent;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
import org.openide.windows.TopComponent;


Expand Down Expand Up @@ -119,7 +121,7 @@ public Object[] keys() {


private Object[] keys(boolean all) {
java.util.Set keys = new java.util.HashSet();
Set<Object> keys = new HashSet<>();

if (delegate != null) {
Object[] delegateKeys;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public ExclusionResult(Lookup.Result delegate) {

public Collection allInstances() {
// this shall remove duplicates??
Set s = new HashSet(delegate.allInstances());
Set<Lookup.Result> s = new HashSet<>(delegate.allInstances());
return s;
}

Expand All @@ -109,9 +109,9 @@ public Set allClasses() {

public Collection allItems() {
// remove duplicates..
Set s = new HashSet(delegate.allItems());
Iterator<Lookup.Item> it = s.iterator();
Set instances = new HashSet();
Set<Lookup.Item> s = new HashSet<>(delegate.allItems());
Iterator it = s.iterator();
Set instances = new HashSet<>();
while (it.hasNext()) {
Lookup.Item i = (Lookup.Item)it.next();
if (instances.contains(i.getInstance())) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ static Object entryQueryMode(Class c) {
*/
static Object entryAllClassesMode() {
Object prev = QUERY_MODE.get();
QUERY_MODE.set(new HashSet());
QUERY_MODE.set(new HashSet<Object>());

return prev;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import java.beans.VetoableChangeListener;

import java.util.*;
import java.util.stream.Collectors;


/** Extends the functionality of <CODE>SystemOption</CODE>
Expand All @@ -45,11 +46,11 @@ public VetoSystemOption() {
/** Lazy getter for veto hashtable.
* @return the hashtable
*/
private HashSet getVeto() {
HashSet set = (HashSet) getProperty(PROP_VETO_SUPPORT);
private Set<VetoableChangeListener> getVeto() {
Set<VetoableChangeListener> set = (HashSet<VetoableChangeListener>)getProperty(PROP_VETO_SUPPORT);

if (set == null) {
set = new HashSet();
set = new HashSet<>();
putProperty(PROP_VETO_SUPPORT, set);
}

Expand Down Expand Up @@ -87,7 +88,7 @@ public final void fireVetoableChange(String name, Object oldValue, Object newVal
Iterator<VetoableChangeListener> en;

synchronized (getLock()) {
en = ((HashSet<VetoableChangeListener>)getVeto().clone()).iterator();
en = getVeto().stream().collect(Collectors.toSet()).iterator();
}

while (en.hasNext()) {
Expand Down

0 comments on commit c53f6b6

Please sign in to comment.