Skip to content

Commit

Permalink
[NETBEANS-4925] - cleanup Map raw type warnings..
Browse files Browse the repository at this point in the history
Hey, it's me again.. The Netbeans Rust Remover..

There are a bunch of warnings related to raw type usage of the Map interface..

   [repeat] /home/bwalker/src/netbeans/enterprise/websvc.rest/src/org/netbeans/modules/websvc/rest/support/SourceGroupSupport.java:170: warning: [rawtypes] found raw type: Map
   [repeat]         Map result;
   [repeat]         ^
   [repeat]   missing type arguments for generic class Map<K,V>
   [repeat]   where K,V are type-variables:
   [repeat]     K extends Object declared in interface Map
   [repeat]     V extends Object declared in interface Map

This change cleans some of this up..
  • Loading branch information
BradWalker authored and lkishalmi committed Oct 26, 2020
1 parent 3a2cad1 commit 15a6010
Show file tree
Hide file tree
Showing 25 changed files with 82 additions and 88 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,8 @@
public class BreakpointAnnotationListener extends DebuggerManagerAdapter
implements PropertyChangeListener {

private Map breakpointToAnnotation = new HashMap ();


private Map<CPPLiteBreakpoint, DebuggerBreakpointAnnotation> breakpointToAnnotation = new HashMap<>();

@Override
public String[] getProperties () {
return new String[] {DebuggerManager.PROP_BREAKPOINTS};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -466,10 +466,10 @@ private String formatJvmOption(String jvmOption) {


public HashMap<String,Map> getSunDatasourcesFromXml(){
HashMap<String,Map> dSources = new HashMap<String,Map>();
HashMap<String, Map> dSources = new HashMap<>();
Document domainDoc = getDomainDocument();
if (domainDoc != null) {
HashMap<String,NamedNodeMap> dsMap = getDataSourcesAttrMap(domainDoc);
Map<String,NamedNodeMap> dsMap = getDataSourcesAttrMap(domainDoc);
HashMap<String,Node> cpMap = getConnPoolsNodeMap(domainDoc);
dsMap.keySet().removeAll(Arrays.asList(sysDatasources));
String[] ds = dsMap.keySet().toArray(new String[dsMap.size()]);
Expand Down Expand Up @@ -497,7 +497,7 @@ private HashMap<String,String> getPoolValues(HashMap cpMap, String poolName) {
NodeList propsNodeList = cpElement.getElementsByTagName(CONST_PROP);

//Cycle through each property element
HashMap<String, String> map = new HashMap<>();
Map<String, String> map = new HashMap<>();
for (int j = 0; j < propsNodeList.getLength(); j++) {
Node propNode = propsNodeList.item(j);
NamedNodeMap propsMap = propNode.getAttributes();
Expand Down Expand Up @@ -533,7 +533,7 @@ private HashMap<String,String> getPoolValues(HashMap cpMap, String poolName) {
}

public HashMap<String,Map> getConnPoolsFromXml(){
HashMap<String,Map> pools = new HashMap<String,Map>();
HashMap<String, Map> pools = new HashMap<>();
Document domainDoc = getDomainDocument();
if (domainDoc != null) {
HashMap<String,Node> cpMap = getConnPoolsNodeMap(domainDoc);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,15 @@ public final class DDProvider {
private static final String APP_13_DOCTYPE = "-//Sun Microsystems, Inc.//DTD J2EE Application 1.3//EN"; //NOI18N
private static final DDProvider ddProvider = new DDProvider();

private final Map ddMap;
private final Map<FileObject, ApplicationProxy> ddMap;

private static final Logger LOGGER = Logger.getLogger(DDProvider.class.getName());

ResourceBundle bundle = ResourceBundle.getBundle("org/netbeans/modules/j2ee/dd/Bundle");

private DDProvider() {
//ddMap=new java.util.WeakHashMap(5);
ddMap = new HashMap(5);
ddMap = new HashMap<>(5);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,13 @@
public final class DDProvider {
private static final String EJB_21_DOCTYPE = "http://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd"; //NOI18N
private static final DDProvider ddProvider = new DDProvider();
private final Map ddMap;
private final Map<Object, EjbJarProxy> ddMap;

/**
* Creates a new instance of DDProvider.
*/
private DDProvider() {
ddMap = new HashMap(5);
ddMap = new HashMap<>(5);
}

/**
Expand Down Expand Up @@ -142,16 +142,7 @@ public EjbJar getDDRootCopy(FileObject fo) throws java.io.IOException {
}

private EjbJarProxy getFromCache (Object o) {
/* WeakReference wr = (WeakReference) ddMap.get(o);
if (wr == null) {
return null;
}
EjbJarProxy ejbJarProxy = (EjbJarProxy) wr.get ();
if (ejbJarProxy == null) {
ddMap.remove (o);
}
return ejbJarProxy;*/
return (EjbJarProxy) ddMap.get(o);
return ddMap.get(o);
}

private void putToCache(Object o, EjbJarProxy ejbJarProxy) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
package org.netbeans.modules.j2ee.dd.impl.common;

import java.util.logging.Level;
import java.util.Map;
import java.util.HashMap;
import java.util.logging.Logger;
import org.netbeans.modules.schema2beans.Version;
import org.netbeans.modules.j2ee.dd.api.common.IconInterface;
Expand Down Expand Up @@ -85,13 +87,13 @@ public void setDisplayName(String displayName) {
}
}

public void setAllDisplayNames(java.util.Map displayNames) throws VersionNotSupportedException {
public void setAllDisplayNames(Map displayNames) throws VersionNotSupportedException {
removeAllDisplayNames();
if (displayNames!=null) {
java.util.Iterator entries = displayNames.entrySet().iterator();
int i=0;
while (entries.hasNext()) {
java.util.Map.Entry entry = (java.util.Map.Entry) entries.next();
Map.Entry entry = (Map.Entry) entries.next();
String key = (String) entry.getKey();
addDisplayName((String) entry.getValue());
setDisplayNameXmlLang(i++, key);
Expand All @@ -113,8 +115,8 @@ public String getDefaultDisplayName() {
return getDisplayName(null);
} catch (VersionNotSupportedException ex){return null;}
}
public java.util.Map getAllDisplayNames() {
java.util.Map map =new java.util.HashMap();
public Map getAllDisplayNames() {
Map<String, String> map =new HashMap<>();
for (int i=0;i<sizeDisplayName();i++) {
String desc=getDisplayName(i);
String loc=getDisplayNameXmlLang(i);
Expand All @@ -124,7 +126,7 @@ public java.util.Map getAllDisplayNames() {
}

public void removeDisplayNameForLocale(String locale) throws VersionNotSupportedException {
java.util.Map map = new java.util.HashMap();
Map map = new java.util.HashMap();
for (int i=0;i<sizeDisplayName();i++) {
String desc=getDisplayName(i);
String loc=getDisplayNameXmlLang(i);
Expand Down Expand Up @@ -236,8 +238,8 @@ public org.netbeans.modules.j2ee.dd.api.common.Icon getDefaultIcon() {
}
return null;
}
public java.util.Map getAllIcons() {
java.util.Map map =new java.util.HashMap();
public Map getAllIcons() {
Map map =new java.util.HashMap();
org.netbeans.modules.j2ee.dd.api.common.Icon[] icons = getIcon();
for (int i=0;i<icons.length;i++) {
String[] iconPair = new String[] {icons[i].getSmallIcon(),icons[i].getLargeIcon()};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@

package org.netbeans.modules.j2ee.dd.impl.common;

import java.util.Map;
import java.util.HashMap;

import java.util.logging.Level;
import java.util.logging.Logger;
import org.netbeans.modules.schema2beans.Version;
Expand Down Expand Up @@ -77,7 +80,7 @@ public void setDescription(String description) {
}
}

public void setAllDescriptions(java.util.Map descriptions) throws VersionNotSupportedException {
public void setAllDescriptions(Map descriptions) throws VersionNotSupportedException {
removeAllDescriptions();
if (descriptions!=null) {
java.util.Iterator keys = descriptions.keySet().iterator();
Expand Down Expand Up @@ -106,8 +109,8 @@ public String getDefaultDescription() {
return null;
}
}
public java.util.Map getAllDescriptions() {
java.util.Map map =new java.util.HashMap();
public Map getAllDescriptions() {
Map<String, String> map =new HashMap<>();
for (int i=0;i<sizeDescription();i++) {
String desc=getDescription(i);
String loc=getDescriptionXmlLang(i);
Expand All @@ -117,7 +120,7 @@ public java.util.Map getAllDescriptions() {
}

public void removeDescriptionForLocale(String locale) throws VersionNotSupportedException {
java.util.Map map = new java.util.HashMap();
Map<String, String> map = new HashMap<>();
for (int i=0;i<sizeDescription();i++) {
String desc=getDescription(i);
String loc=getDescriptionXmlLang(i);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ private String formatJvmOption(String jvmOption) {


public HashMap<String,Map> getSunDatasourcesFromXml(){
HashMap<String,Map> dSources = new HashMap<String,Map>();
HashMap<String,Map> dSources = new HashMap<>();
Document domainDoc = getDomainDocument();
if (domainDoc != null) {
HashMap<String,NamedNodeMap> dsMap = getDataSourcesAttrMap(domainDoc);
Expand Down Expand Up @@ -526,7 +526,7 @@ private HashMap<String,String> getPoolValues(HashMap cpMap, String poolName) {
}

public HashMap<String,Map> getConnPoolsFromXml(){
HashMap<String,Map> pools = new HashMap<String,Map>();
HashMap<String,Map> pools = new HashMap<>();
Document domainDoc = getDomainDocument();
if (domainDoc != null) {
HashMap<String,Node> cpMap = getConnPoolsNodeMap(domainDoc);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -278,13 +278,13 @@ private void setColumns(MBeanServerConnection connection, ObjectName wldf) throw
return;
}

Map columnIndexMap = (Map) connection.getAttribute(wldf, "ColumnIndexMap"); // NOI18N
recordIdIndex = ((Integer) columnIndexMap.get("RECORDID")); // NOI18N
timestampIndex = ((Integer) columnIndexMap.get("DATE")); // NOI18N
severityIndex = ((Integer) columnIndexMap.get("SEVERITY")); // NOI18N
subsystemIndex = ((Integer) columnIndexMap.get("SUBSYSTEM")); // NOI18N
messageIdIndex = ((Integer) columnIndexMap.get("MSGID")); // NOI18N
messageIndex = ((Integer) columnIndexMap.get("MESSAGE")); // NOI18N
Map<String, Integer> columnIndexMap = (Map<String, Integer>)connection.getAttribute(wldf, "ColumnIndexMap"); // NOI18N
recordIdIndex = columnIndexMap.get("RECORDID"); // NOI18N
timestampIndex = columnIndexMap.get("DATE"); // NOI18N
severityIndex = columnIndexMap.get("SEVERITY"); // NOI18N
subsystemIndex = columnIndexMap.get("SUBSYSTEM"); // NOI18N
messageIdIndex = columnIndexMap.get("MSGID"); // NOI18N
messageIndex = columnIndexMap.get("MESSAGE"); // NOI18N
configured = true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,11 +167,11 @@ public static FileObject getFolderForPackage(SourceGroup sourceGroup, String pgk
}

private static Map createFoldersToSourceGroupsMap(final SourceGroup[] sourceGroups) {
Map result;
Map<FileObject, SourceGroup> result;
if (sourceGroups.length == 0) {
result = Collections.EMPTY_MAP;
} else {
result = new HashMap(2 * sourceGroups.length, .5f);
result = new HashMap<>(2 * sourceGroups.length, .5f);
for (int i = 0; i < sourceGroups.length; i++) {
SourceGroup sourceGroup = sourceGroups[i];
result.put(sourceGroup.getRootFolder(), sourceGroup);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,10 @@ private static void setPrimaryKeyColumns(List<TableColumn> pks,
*/
private static void setColumnFormatToStandard(DatabaseConnector connector,
AbstractTableColumn column) {
Map props = connector.getDatabaseSpecification().getProperties();
Map<String, Map> props = connector.getDatabaseSpecification().getProperties();
Map cprops = connector.getDatabaseSpecification().getCommandProperties(
Specification.CREATE_TABLE);
Map bindmap = (Map) cprops.get("Binding"); // NOI18N
Map<String, String> bindmap = (Map) cprops.get("Binding"); // NOI18N
String tname = (String) bindmap.get(TableColumn.COLUMN);
column.setFormat((String) ((Map) props.get(tname)).get(
"Format")); //NOI18N
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ private DefaultPathRecognizer(Set<String> sourcePathIds, Set<String> libraryPath
this.mimeTypes = mimeTypes;
}

private static Set<String> readIdsAttribute(Map fileAttributes, String attributeName) {
Set<String> ids = new HashSet<String>();
private static Set<String> readIdsAttribute(Map<String, ?> fileAttributes, String attributeName) {
Set<String> ids = new HashSet<>();

Object attributeValue = fileAttributes.get(attributeName); //NOI18N
if (attributeValue instanceof String) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ private static void clearDrawingCache(JTree tree) {
try {
Field drawingCacheField = BasicTreeUI.class.getDeclaredField("drawingCache");
drawingCacheField.setAccessible(true);
Map table = (Map) drawingCacheField.get(tui);
Map<BasicTreeUI, Map> table = (Map) drawingCacheField.get(tui);
table.clear();
} catch (Exception ex) {}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,17 @@
class DTDGrammar implements ExtendedGrammarQuery {

// element name keyed
private Map elementDecls, attrDecls;
private Map<String, Set> elementDecls, attrDecls;

// Map<elementName:String, model:String || model:ContentModel || null>
// this map is filled asynchronously as it takes some time
private Map contentModels;

// Map<elementname + " " + attributename, List<String>>
private Map attrEnumerations;
private Map<String, List> attrEnumerations;

// Map<elementname + " " + attributename, String>
private Map defaultAttributeValues;
private Map<String, String> defaultAttributeValues;

private Set<String> entities, notations;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,7 @@ private static void fillPublicNodeTypesInheritanceTree (Set<Item> layer, String
*/
private static class Item {
/** */
private static Map itemMap;
private static Map<Class, Item> itemMap;

/** */
private final NamedClass clazz;
Expand Down Expand Up @@ -651,12 +651,12 @@ public boolean equals (Object obj) {
*/
private static Item getItem (Class clazz) {
if ( itemMap == null ) {
itemMap = new HashMap();
itemMap = new HashMap<>();
}

Item item = (Item) itemMap.get (clazz);
Item item = itemMap.get(clazz);
if ( item == null ) {
itemMap.put (clazz, item = new Item (new NamedClass (clazz)));
itemMap.put(clazz, item = new Item (new NamedClass (clazz)));
}
return item;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public final class XSLGrammarQuery implements GrammarQuery{
* should contain XPath expression. The element name keys should
* not contain the namespace prefix.
*/
private static Map exprAttributes;
private static Map<String, String> exprAttributes;

/** A set containing all functions allowed in XSLT */
private static Set xslFunctions;
Expand Down Expand Up @@ -388,7 +388,7 @@ private static Set getXPathAxes() {

private static Map getExprAttributes() {
if (exprAttributes == null) {
exprAttributes = new HashMap();
exprAttributes = new HashMap<>();
exprAttributes.put("key", "use"); // NOI18N
exprAttributes.put("value-of", "select"); // NOI18N
exprAttributes.put("copy-of", "select"); // NOI18N
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ public int[] interestedInLogLevels (AntSession session) {
private Map<AntDebugger, AntSession> runningDebuggers2 = new HashMap<>();
private Set<File> filesToDebug = new HashSet<>();
/** File => WeakReference -> ExecutorTask */
private Map fileExecutors = new HashMap();
private Map<File, WeakReference> fileExecutors = new HashMap<>();

void debugFile (File f) {
filesToDebug.add (f);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,8 @@
public class BreakpointAnnotationListener extends DebuggerManagerAdapter
implements PropertyChangeListener {

private Map breakpointToAnnotation = new HashMap ();


private Map<AntBreakpoint, DebuggerBreakpointAnnotation> breakpointToAnnotation = new HashMap<>();

@Override
public String[] getProperties () {
return new String[] {DebuggerManager.PROP_BREAKPOINTS};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public void setVersionNo(int versionNo) {
}

/** Cache for read schemas. */
protected static Map schemaCache = new HashMap();
protected static Map<String, SchemaElement> schemaCache = new HashMap<>();

/** Last used schema. */
private static SchemaElement lastSchema;
Expand Down
Loading

0 comments on commit 15a6010

Please sign in to comment.