Skip to content

Commit

Permalink
[NETBEANS-6045] - cleanup ArrayList warnings (apache#3185)
Browse files Browse the repository at this point in the history
* [NETBEANS-6045] - cleanup ArrayList warnings

Cleanup a bunch of warnings related to ArrayList..

[repeat] /home/bwalker/src/netbeans/java/java.hints.ui/src/org/netbeans/modules/java/hints/analysis/AnalyzerImpl.java:98: warning: [rawtypes] found raw type: ArrayList
[repeat] List todo = new ArrayList();
[repeat] ^
[repeat] missing type arguments for generic class ArrayList
[repeat] where E is a type-variable:
[repeat] E extends Object declared in class ArrayList
  • Loading branch information
BradWalker authored Sep 23, 2021
1 parent a549631 commit 9cdf92f
Show file tree
Hide file tree
Showing 25 changed files with 99 additions and 77 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,15 @@
*
* @author Nitya Doraisamy
*/
import java.beans.PropertyChangeListener;
import java.util.ArrayList;
import java.util.List;
import org.netbeans.modules.j2ee.dd.api.webservices.Webservices;

public class WebServicesProxy implements Webservices {
private Webservices webSvc;
private String version;
private java.util.List listeners;
private final List<PropertyChangeListener> listeners;
private boolean writing = false;
private org.xml.sax.SAXParseException error;
private int ddStatus;
Expand All @@ -42,14 +45,13 @@ public class WebServicesProxy implements Webservices {
public WebServicesProxy(Webservices webService, String version) {
this.webSvc = webService;
this.version = version;
listeners = new java.util.ArrayList();
listeners = new ArrayList<>();
}

public void setOriginal(Webservices webSvc) {
if (this.webSvc != webSvc) {
for (int i=0;i<listeners.size();i++) {
java.beans.PropertyChangeListener pcl =
(java.beans.PropertyChangeListener)listeners.get(i);
PropertyChangeListener pcl = listeners.get(i);
if (this.webSvc != null) this.webSvc.removePropertyChangeListener(pcl);
if (webSvc != null) webSvc.addPropertyChangeListener(pcl);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,21 @@

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

import java.util.ArrayList;
import java.util.List;
import java.math.BigDecimal;

import org.netbeans.modules.j2ee.dd.api.application.Application;

import java.beans.PropertyChangeListener;

/**
* @author Nitya Doraisamy
*/
public class ApplicationProxy implements Application {
private Application app;
private String version;
private java.util.List listeners;
private List<PropertyChangeListener> listeners;
public boolean writing=false;
private OutputProvider outputProvider;
private org.xml.sax.SAXParseException error;
Expand All @@ -40,14 +45,13 @@ public class ApplicationProxy implements Application {
public ApplicationProxy(Application app, String version) {
this.app = app;
this.version = version;
listeners = new java.util.ArrayList();
listeners = new ArrayList<>();
}

public void setOriginal(Application app) {
if (this.app != app) {
for (int i=0;i<listeners.size();i++) {
java.beans.PropertyChangeListener pcl =
(java.beans.PropertyChangeListener)listeners.get(i);
java.beans.PropertyChangeListener pcl = listeners.get(i);
if (this.app != null) this.app.removePropertyChangeListener(pcl);
if (app != null) app.addPropertyChangeListener(pcl);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,14 @@
*
* @author Nitya Doraisamy
*/
import java.beans.PropertyChangeListener;
import java.math.BigDecimal;
import java.util.Iterator;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;

import org.netbeans.modules.j2ee.dd.api.client.AppClient;
import org.netbeans.modules.j2ee.dd.api.common.VersionNotSupportedException;
import org.openide.filesystems.FileAlreadyLockedException;
Expand All @@ -36,7 +40,7 @@ public class AppClientProxy implements AppClient {

private AppClient app;
private String version;
private java.util.List listeners;
private List<PropertyChangeListener> listeners;
public boolean writing=false;
private OutputProvider outputProvider;
private org.xml.sax.SAXParseException error;
Expand All @@ -51,7 +55,7 @@ public class AppClientProxy implements AppClient {
public AppClientProxy(AppClient app, String version) {
this.app = app;
this.version = version;
listeners = new java.util.ArrayList();
listeners = new ArrayList<>();
}

public void setOriginal(AppClient app) {
Expand Down Expand Up @@ -81,7 +85,7 @@ public void setProxyVersion(java.lang.String value) {
new java.beans.PropertyChangeEvent(this, PROPERTY_VERSION, version, value);
version=value;
for (Iterator i = listeners.iterator(); i.hasNext();) {
((java.beans.PropertyChangeListener) i.next()).propertyChange(evt);
((PropertyChangeListener) i.next()).propertyChange(evt);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,17 @@
*/
package org.netbeans.modules.j2ee.dd.impl.common;

import java.util.ArrayList;
import java.util.logging.Level;
import java.util.Map;
import java.util.HashMap;
import java.util.List;
import java.util.logging.Logger;
import org.netbeans.modules.schema2beans.Version;
import org.netbeans.modules.j2ee.dd.api.common.IconInterface;
import org.netbeans.modules.j2ee.dd.api.common.VersionNotSupportedException;
import org.netbeans.modules.j2ee.dd.api.common.DisplayNameInterface;
import org.netbeans.modules.j2ee.dd.api.common.Icon;

public abstract class ComponentBeanMultiple extends DescriptionBeanMultiple implements DisplayNameInterface, IconInterface {

Expand Down Expand Up @@ -340,8 +343,8 @@ private String getIcon(String locale, boolean isSmall) throws VersionNotSupporte
}

public void removeIcon(String locale, boolean isSmall) throws VersionNotSupportedException {
org.netbeans.modules.j2ee.dd.api.common.Icon[] icons = getIcon();
java.util.List iconList = new java.util.ArrayList();
Icon[] icons = getIcon();
List<Icon> iconList = new ArrayList<>();
for (int i=0;i<icons.length;i++) {
String loc=icons[i].getXmlLang();
if ((locale==null && loc==null) || (locale!=null && locale.equalsIgnoreCase(loc))) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,12 @@
import org.openide.filesystems.FileObject;
import org.openide.filesystems.FileLock;

import java.beans.PropertyChangeListener;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.io.OutputStream;

import org.w3c.dom.Element;

/**
Expand All @@ -40,7 +44,7 @@
public class EjbJarProxy implements EjbJar {
private EjbJar ejbJar;
private String version;
private java.util.List listeners;
private List<PropertyChangeListener> listeners;
public boolean writing=false;
private org.xml.sax.SAXParseException error;
private int ddStatus;
Expand All @@ -50,15 +54,15 @@ public class EjbJarProxy implements EjbJar {
public EjbJarProxy(EjbJar ejbJar, String version) {
this.ejbJar=ejbJar;
this.version = version;
listeners = new java.util.ArrayList();
listeners = new ArrayList<>();
addPropertyChangeListener(reindentationListener);
}

public void setOriginal(EjbJar ejbJar) {
if (this.ejbJar!=ejbJar) {
for (int i=0;i<listeners.size();i++) {
java.beans.PropertyChangeListener pcl =
(java.beans.PropertyChangeListener)listeners.get(i);
listeners.get(i);
if (this.ejbJar!=null) this.ejbJar.removePropertyChangeListener(pcl);
if (ejbJar!=null) ejbJar.addPropertyChangeListener(pcl);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,28 @@
package org.netbeans.modules.j2ee.dd.impl.web;

import org.netbeans.modules.j2ee.dd.api.common.VersionNotSupportedException;
import org.netbeans.modules.j2ee.dd.api.web.AbsoluteOrdering;
import org.netbeans.modules.j2ee.dd.api.web.JspConfig;
import org.netbeans.modules.j2ee.dd.api.web.WebApp;
import org.netbeans.modules.j2ee.dd.impl.common.DDProviderDataObject;
import org.netbeans.modules.schema2beans.Schema2BeansUtil;
import org.netbeans.modules.schema2beans.BaseBean;
import org.openide.loaders.DataObject;
import org.openide.filesystems.FileLock;

import java.beans.PropertyChangeListener;

import java.io.OutputStream;
import org.netbeans.modules.j2ee.dd.api.web.AbsoluteOrdering;
import java.util.ArrayList;
import java.util.List;

/**
* @author mk115033
*/
public class WebAppProxy implements WebApp {
private WebApp webApp;
private String version;
private java.util.List listeners;
private final List<PropertyChangeListener> listeners;
public boolean writing=false;
private org.xml.sax.SAXParseException error;
private int ddStatus;
Expand All @@ -46,15 +51,14 @@ public class WebAppProxy implements WebApp {
public WebAppProxy(WebApp webApp, String version) {
this.webApp=webApp;
this.version = version;
listeners = new java.util.ArrayList();
listeners = new ArrayList<>();
addPropertyChangeListener(reindentationListener);
}

public void setOriginal(WebApp webApp) {
if (this.webApp!=webApp) {
for (int i=0;i<listeners.size();i++) {
java.beans.PropertyChangeListener pcl =
(java.beans.PropertyChangeListener)listeners.get(i);
java.beans.PropertyChangeListener pcl = listeners.get(i);
if (this.webApp!=null) this.webApp.removePropertyChangeListener(pcl);
if (webApp!=null) webApp.addPropertyChangeListener(pcl);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -498,12 +498,12 @@ public HelpCtx getHelpCtx() {

private RequestProcessor.Task elementTask;
private List deletedEjbNames;
private List newFileNames;
private List<String> newFileNames;

private void elementCreated(final String elementName) {
synchronized (this) {
if (newFileNames==null) {
newFileNames=new ArrayList();
newFileNames=new ArrayList<>();
}
newFileNames.add(elementName);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -291,13 +291,13 @@ public HelpCtx getHelpCtx() {
}

private RequestProcessor.Task elementTask;
private List deletedEjbNames;
private List newFileNames;
private List<String> deletedEjbNames;
private List<String> newFileNames;

private void elementCreated(final String elementName) {
synchronized (this) {
if (newFileNames == null) {
newFileNames = new ArrayList();
newFileNames = new ArrayList<>();
}
newFileNames.add(elementName);
}
Expand Down Expand Up @@ -388,7 +388,7 @@ public void fileDeleted(FileEvent fileEvent) {
if (resourceName.equals(ejbs[i].getEjbClass())) {
synchronized (this) {
if (deletedEjbNames == null) {
deletedEjbNames = new ArrayList();
deletedEjbNames = new ArrayList<>();
}
deletedEjbNames.add(resourceName);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.WeakHashMap;
import java.util.List;
import java.util.Map;
import java.util.WeakHashMap;
import java.lang.ref.WeakReference;
import org.netbeans.modules.j2ee.dd.api.web.DDProvider;
import org.netbeans.modules.j2ee.dd.api.web.Servlet;
Expand Down Expand Up @@ -151,7 +152,7 @@ public static FileObject[] getFacesConfigFiles(WebModule webModule){
if (documentBase == null) {
return new FileObject [0];
}
ArrayList files = new ArrayList();
List<FileObject> files = new ArrayList<>();
FileObject file;
for (int i = 0; i < sFiles.length; i++){
file = documentBase.getFileObject(sFiles[i]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import java.io.IOException;
import java.io.Reader;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.codehaus.groovy.antlr.parser.GroovyRecognizer;
Expand Down Expand Up @@ -233,7 +234,7 @@ public State getState() {
public void setState(State d) {
if (d != null) {
stringCtorState = d.stringCtorState;
parenLevelStack = new ArrayList(d.parenLevelStack);
parenLevelStack = new ArrayList<>(d.parenLevelStack);
}
}
}
Expand All @@ -246,11 +247,11 @@ public void setState(State d) {
private static class State {

private final int stringCtorState;
private final ArrayList parenLevelStack;
private final List parenLevelStack;

public State(int stringCtorState, ArrayList parenLevelStack) {
this.stringCtorState = stringCtorState;
this.parenLevelStack = new ArrayList(parenLevelStack);
this.parenLevelStack = new ArrayList<>(parenLevelStack);
}

@Override
Expand Down
Loading

0 comments on commit 9cdf92f

Please sign in to comment.