Skip to content

Commit

Permalink
Cleanup warning messages related to redundant cast (apache#3634)
Browse files Browse the repository at this point in the history
Warning messages like this will no longer happen.

   [repeat] /home/bwalker/src/netbeans/enterprise/websvc.manager/src/org/netbeans/modules/websvc/manager/ui/ReflectionHelper.java:700: warning: [cast] redundant cast to JavaParameter
   [repeat]                     JavaParameter actualParameter = (JavaParameter) parameterList.get(ii);
   [repeat]                                                     ^
  • Loading branch information
BradWalker authored Feb 19, 2022
1 parent eb38d73 commit 971b3cc
Show file tree
Hide file tree
Showing 183 changed files with 355 additions and 368 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ private static Breakpoint[] getBreakpoints () {
}
}
bs = new Breakpoint [bb.size ()];
return (Breakpoint[]) bb.toArray (bs);
return bb.toArray(bs);
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public static WebModule getWebModule (FileObject file) {
Parameters.notNull("file", file); // NOI18N
Iterator<WebModuleProvider> it = implementations.allInstances().iterator();
while (it.hasNext()) {
WebModuleProvider impl = (WebModuleProvider)it.next();
WebModuleProvider impl = it.next();
WebModule wm = impl.findWebModule (file);
if (wm != null) {
return wm;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -516,13 +516,13 @@ private HashMap<String,String> getPoolValues(HashMap cpMap, String poolName) {
}
} // connection-pool properties

pValues.put(CONST_LOWER_DATABASE_NAME, (String) map.get(CONST_LOWER_DATABASE_NAME));
pValues.put(CONST_PORT_NUMBER, (String) map.get(CONST_PORT_NUMBER));
pValues.put(CONST_LOWER_PORT_NUMBER, (String) map.get(CONST_LOWER_PORT_NUMBER));
pValues.put(CONST_DATABASE_NAME, (String) map.get(CONST_DATABASE_NAME));
pValues.put(CONST_SID, (String) map.get(CONST_SID));
pValues.put(CONST_DRIVER_CLASS, (String) map.get(CONST_DRIVER_CLASS));
pValues.put(CONST_DERBY_CONN_ATTRS, (String) map.get(CONST_DERBY_CONN_ATTRS));
pValues.put(CONST_LOWER_DATABASE_NAME, map.get(CONST_LOWER_DATABASE_NAME));
pValues.put(CONST_PORT_NUMBER, map.get(CONST_PORT_NUMBER));
pValues.put(CONST_LOWER_PORT_NUMBER, map.get(CONST_LOWER_PORT_NUMBER));
pValues.put(CONST_DATABASE_NAME, map.get(CONST_DATABASE_NAME));
pValues.put(CONST_SID, map.get(CONST_SID));
pValues.put(CONST_DRIVER_CLASS, map.get(CONST_DRIVER_CLASS));
pValues.put(CONST_DERBY_CONN_ATTRS, map.get(CONST_DERBY_CONN_ATTRS));
if (dsClassName != null) {
pValues.put("dsClassName", dsClassName.getNodeValue());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ private HashMap<String, String> getMapEntry(StartElement entry) {
HashMap<String, String> entryMap = new HashMap<>();
Iterator<Attribute> iter = entry.getAttributes();
while (iter.hasNext()) {
Attribute att = (Attribute) iter.next();
Attribute att = iter.next();
entryMap.put(att.getName().getLocalPart(), att.getValue());
}
return entryMap;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public ProjectCarProvider () {
public org.netbeans.modules.j2ee.api.ejbjar.Car findCar (org.openide.filesystems.FileObject file) {
Project project = FileOwnerQuery.getOwner (file);
if (project != null) {
CarProvider provider = (CarProvider) project.getLookup ().lookup (CarProvider.class);
CarProvider provider = project.getLookup().lookup(CarProvider.class);
if (provider != null) {
return provider.findCar(file);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public ProjectEarProvider () {
public org.netbeans.modules.j2ee.api.ejbjar.Ear findEar (org.openide.filesystems.FileObject file) {
Project project = FileOwnerQuery.getOwner (file);
if (project != null) {
EarProvider provider = (EarProvider) project.getLookup ().lookup (EarProvider.class);
EarProvider provider = project.getLookup().lookup(EarProvider.class);
if (provider != null) {
return provider.findEar (file);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public ProjectEjbJarProvider () {
public org.netbeans.modules.j2ee.api.ejbjar.EjbJar findEjbJar (org.openide.filesystems.FileObject file) {
Project project = FileOwnerQuery.getOwner (file);
if (project != null) {
EjbJarProvider provider = (EjbJarProvider) project.getLookup ().lookup (EjbJarProvider.class);
EjbJarProvider provider = project.getLookup().lookup(EjbJarProvider.class);
if (provider != null) {
return provider.findEjbJar (file);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ private J2eeProjectView() {
*/
public static EjbNodesFactory getEjbNodesFactory () {
if (factoryInstance == null) {
factoryInstance = (EjbNodesFactory) Lookup.getDefault().lookup(EjbNodesFactory.class);
factoryInstance = Lookup.getDefault().lookup(EjbNodesFactory.class);
}
if (factoryInstance == null) {
Logger.getLogger("global").log(Level.INFO, "No EjbNodesFactory instance available: Enterprise Beans nodes cannot be creater");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public LibrariesNodeFactory() {
}

public NodeList createNodes(Project p) {
AppClientProject project = (AppClientProject)p.getLookup().lookup(AppClientProject.class);
AppClientProject project = p.getLookup().lookup(AppClientProject.class);
assert project != null;
return new LibrariesNodeList(project);
}
Expand All @@ -82,7 +82,7 @@ private static class LibrariesNodeList implements NodeList<String>, PropertyChan
LibrariesNodeList(AppClientProject proj) {
project = proj;
testSources = project.getTestSourceRoots();
AppClientLogicalViewProvider logView = (AppClientLogicalViewProvider)project.getLookup().lookup(AppClientLogicalViewProvider.class);
AppClientLogicalViewProvider logView = project.getLookup().lookup(AppClientLogicalViewProvider.class);
assert logView != null;
evaluator = project.evaluator();
helper = project.getUpdateHelper();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public SetupDirNodeFactory() {
}

public NodeList createNodes(Project p) {
AppClientProject project = (AppClientProject) p.getLookup().lookup(AppClientProject.class);
AppClientProject project = p.getLookup().lookup(AppClientProject.class);
assert project != null;
return new SetupDirNodeList(project);
}
Expand All @@ -58,7 +58,7 @@ private static class SetupDirNodeList implements NodeList<String>, PropertyChang

SetupDirNodeList(AppClientProject proj) {
project = proj;
AppClientLogicalViewProvider logView = (AppClientLogicalViewProvider) project.getLookup().lookup(AppClientLogicalViewProvider.class);
AppClientLogicalViewProvider logView = project.getLookup().lookup(AppClientLogicalViewProvider.class);
assert logView != null;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public ProjectCustomizer.Category createCategory(Lookup context) {
null,
(ProjectCustomizer.Category[]) null );
} else if (WEBSERVICESCATEGORY.equals(name)) {
AppClientProject project = (AppClientProject) context.lookup(AppClientProject.class);
AppClientProject project = context.lookup(AppClientProject.class);
List serviceClientsSettings = null;
WebServicesClientSupport clientSupport = WebServicesClientSupport.getWebServicesClientSupport(project.getProjectDirectory());
if (clientSupport != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,7 @@ private void storeProperties() throws IOException {
updateHelper.putProperties( AntProjectHelper.PROJECT_PROPERTIES_PATH, projectProperties );
updateHelper.putProperties( AntProjectHelper.PRIVATE_PROPERTIES_PATH, privateProperties );

String value = (String)additionalProperties.get(SOURCE_ENCODING);
String value = additionalProperties.get(SOURCE_ENCODING);
if (value != null) {
try {
FileEncodingQuery.setDefaultEncoding(Charset.forName(value));
Expand Down Expand Up @@ -602,7 +602,7 @@ private void resolveProjectDependencies() {
// 1. first remove all project references. The method will modify
// project property files, so it must be done separately
for (Iterator<ClassPathSupport.Item> it = removed.iterator(); it.hasNext(); ) {
ClassPathSupport.Item item = (ClassPathSupport.Item)it.next();
ClassPathSupport.Item item = it.next();
if ( item.getType() == ClassPathSupport.Item.TYPE_ARTIFACT ||
item.getType() == ClassPathSupport.Item.TYPE_JAR ) {
refHelper.destroyReference(item.getReference());
Expand All @@ -617,7 +617,7 @@ private void resolveProjectDependencies() {
boolean changed = false;

for (Iterator<ClassPathSupport.Item> it = removed.iterator(); it.hasNext(); ) {
ClassPathSupport.Item item = (ClassPathSupport.Item)it.next();
ClassPathSupport.Item item = it.next();
if (item.getType() == ClassPathSupport.Item.TYPE_LIBRARY) {
// remove helper property pointing to library jar if there is any
String prop = item.getReference();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ private void switchLibrary() {
};
for (int i = 0; i < models.length; i++) {
for (Iterator<ClassPathSupport.Item> it = ClassPathUiSupport.getIterator(models[i]); it.hasNext();) {
ClassPathSupport.Item itm = (ClassPathSupport.Item) it.next();
ClassPathSupport.Item itm = it.next();
if (itm.getType() == ClassPathSupport.Item.TYPE_LIBRARY) {
itm.reassignLibraryManager(man);
}
Expand All @@ -264,7 +264,7 @@ private void testBroken() {

for( int i = 0; i < models.length; i++ ) {
for (Iterator<ClassPathSupport.Item> it = ClassPathUiSupport.getIterator( models[i] ); it.hasNext(); ) {
if ( ((ClassPathSupport.Item)it.next()).isBroken() ) {
if (it.next().isBroken()) {
broken = true;
break;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public void showCustomizer( String preselectedCategory, String preselectedSubCat
return;
}
else {
AppClientProjectProperties uiProperties = new AppClientProjectProperties( (AppClientProject)project, updateHelper, evaluator, refHelper, genFileHelper );
AppClientProjectProperties uiProperties = new AppClientProjectProperties(project, updateHelper, evaluator, refHelper, genFileHelper);
Lookup context = Lookups.fixed(new Object[] {
project,
uiProperties,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public DatasourceCustomizer(List<Datasource> datasources) {
if (datasources != null) { // transform Set to Map for faster searching
this.datasources = new HashMap<String, Datasource>();
for (Iterator<Datasource> it = datasources.iterator(); it.hasNext();) {
Datasource ds = (Datasource) it.next();
Datasource ds = it.next();
if (ds.getJndiName() != null)
this.datasources.put(ds.getJndiName(), ds);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,7 @@ public void run() {
* @return Set<Datasource> returns a set of data sources that don't have corresponding database connections
*/
public static Set<Datasource> getBrokenDatasources(Project project) {
J2eeModuleProvider jmp =
(J2eeModuleProvider)project.getLookup().lookup(J2eeModuleProvider.class);
J2eeModuleProvider jmp = project.getLookup().lookup(J2eeModuleProvider.class);

Set<Datasource> dss = null;
try {
Expand All @@ -136,7 +135,7 @@ public static Set<Datasource> getBrokenDatasources(Project project) {
Set<Datasource> brokenDatasources = new HashSet<Datasource>();
Iterator<Datasource> it = dss.iterator();
while (it.hasNext()) {
Datasource ds = (Datasource)it.next();
Datasource ds = it.next();
if(!isFound(ds)){
brokenDatasources.add(ds);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public void run() {

@Override
public void run() {
J2eeModuleProvider jmp = (J2eeModuleProvider)project.getLookup().lookup(J2eeModuleProvider.class);
J2eeModuleProvider jmp = project.getLookup().lookup(J2eeModuleProvider.class);
String serverInstanceID = jmp.getServerInstanceID();
ServerInstance inst = Deployment.getDefault().getServerInstance(serverInstanceID);
try {
Expand All @@ -123,8 +123,7 @@ public void run() {
}

public static Set<ServerLibraryDependency> getMissingServerLibraries(Project project) {
J2eeModuleProvider jmp =
(J2eeModuleProvider)project.getLookup().lookup(J2eeModuleProvider.class);
J2eeModuleProvider jmp = project.getLookup().lookup(J2eeModuleProvider.class);
Set<ServerLibraryDependency> deps = getDependencies(jmp);

String serverInstanceID = jmp.getServerInstanceID();
Expand All @@ -143,8 +142,7 @@ public static Set<ServerLibraryDependency> getMissingServerLibraries(Project pro
}

public static Set<ServerLibraryDependency> getDeployableServerLibraries(Project project) {
J2eeModuleProvider jmp =
(J2eeModuleProvider)project.getLookup().lookup(J2eeModuleProvider.class);
J2eeModuleProvider jmp = project.getLookup().lookup(J2eeModuleProvider.class);
Set<ServerLibraryDependency> deps = getDependencies(jmp);

String serverInstanceID = jmp.getServerInstanceID();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public static String selectServerDialog(Object[] moduleTypes, String j2eeSpec, S
types.add(type);
}
}
return selectServerDialog((J2eeModule.Type[]) types.toArray(new J2eeModule.Type[types.size()]),
return selectServerDialog(types.toArray(new J2eeModule.Type[types.size()]),
Profile.fromPropertiesString(j2eeSpec), title, description);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ public Webservices getDDRootCopy(FileObject fo) throws java.io.IOException {
}

private WebServicesProxy getFromCache (FileObject fo) {
return (WebServicesProxy) ddMap.get(fo);
return ddMap.get(fo);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public void setAllDisplayNames(java.util.Map displayNames) throws VersionNotSupp
Iterator<String> keys = displayNames.keySet().iterator();
int i=0;
while (keys.hasNext()) {
String key = (String) keys.next();
String key = keys.next();
addDisplayName((String)displayNames.get(key));
setDisplayNameXmlLang(i++, key);
}
Expand Down Expand Up @@ -335,6 +335,6 @@ public void removeIcon(String locale, boolean isSmall) throws VersionNotSupporte
}
}
Iterator<Icon> it = iconList.iterator();
while(it.hasNext()) removeIcon((org.netbeans.modules.j2ee.dd.api.common.Icon)it.next());
while(it.hasNext()) removeIcon(it.next());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public void setAllDescriptions(java.util.Map descriptions) throws VersionNotSupp
Iterator<String> keys = descriptions.keySet().iterator();
int i=0;
while (keys.hasNext()) {
String key = (String) keys.next();
String key = keys.next();
addDescription((String)descriptions.get(key));
setDescriptionXmlLang(i++, key);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public void setProxyVersion(java.lang.String value) {
new java.beans.PropertyChangeEvent(this, PROPERTY_VERSION, version, value);
version = value;
for (int i=0;i<listeners.size();i++) {
((java.beans.PropertyChangeListener)listeners.get(i)).propertyChange(evt);
listeners.get(i).propertyChange(evt);
}
}
}
Expand All @@ -95,7 +95,7 @@ public void setStatus(int value) {
ddStatus, value);
ddStatus = value;
for (int i=0;i<listeners.size();i++) {
((java.beans.PropertyChangeListener)listeners.get(i)).propertyChange(evt);
listeners.get(i).propertyChange(evt);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ public Application getDDRootCopy(FileObject fo) throws IOException {
}

private ApplicationProxy getFromCache (FileObject fo) {
return (ApplicationProxy) ddMap.get(fo);
return ddMap.get(fo);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public WebApp getDDRoot(FileObject fo) throws IOException {
}
} else {
version = original.getVersion();
error = (SAXParseException) errorMap.get(fo.toURL());
error = errorMap.get(fo.toURL());
}
}
if (version != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public void setProxyVersion(java.lang.String value) {
new java.beans.PropertyChangeEvent(this, PROPERTY_VERSION, version, value);
version=value;
for (int i=0;i<listeners.size();i++) {
((java.beans.PropertyChangeListener)listeners.get(i)).propertyChange(evt);
listeners.get(i).propertyChange(evt);
}
}
}
Expand Down Expand Up @@ -200,7 +200,7 @@ public void setStatus(int value) {
new java.beans.PropertyChangeEvent(this, PROPERTY_STATUS, ddStatus, value);
ddStatus=value;
for (int i=0;i<listeners.size();i++) {
((java.beans.PropertyChangeListener)listeners.get(i)).propertyChange(evt);
listeners.get(i).propertyChange(evt);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public AppClientProxy(AppClient app, String version) {
public void setOriginal(AppClient app) {
if (this.app != app) {
for (Iterator<PropertyChangeListener> i = listeners.iterator(); i.hasNext();) {
PropertyChangeListener pcl = (PropertyChangeListener) i.next();
PropertyChangeListener pcl = i.next();
if (this.app != null) this.app.removePropertyChangeListener(pcl);
if (app != null) app.addPropertyChangeListener(pcl);

Expand All @@ -84,7 +84,7 @@ public void setProxyVersion(java.lang.String value) {
new java.beans.PropertyChangeEvent(this, PROPERTY_VERSION, version, value);
version=value;
for (Iterator<PropertyChangeListener> i = listeners.iterator(); i.hasNext();) {
((PropertyChangeListener) i.next()).propertyChange(evt);
i.next().propertyChange(evt);
}
}
}
Expand Down Expand Up @@ -189,7 +189,7 @@ public void setStatus(int value) {
new java.beans.PropertyChangeEvent(this, PROPERTY_STATUS, ddStatus, value);
ddStatus=value;
for (Iterator<PropertyChangeListener> i = listeners.iterator(); i.hasNext();) {
((PropertyChangeListener) i.next()).propertyChange(evt);
i.next().propertyChange(evt);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public void setAllDisplayNames(Map displayNames) throws VersionNotSupportedExcep
Iterator<Map.Entry> entries = displayNames.entrySet().iterator();
int i=0;
while (entries.hasNext()) {
Map.Entry entry = (Map.Entry) entries.next();
Map.Entry entry = entries.next();
String key = (String) entry.getKey();
addDisplayName((String) entry.getValue());
setDisplayNameXmlLang(i++, key);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public void setAllDescriptions(Map descriptions) throws VersionNotSupportedExcep
Iterator<String> keys = descriptions.keySet().iterator();
int i=0;
while (keys.hasNext()) {
String key = (String) keys.next();
String key = keys.next();
addDescription((String)descriptions.get(key));
setDescriptionXmlLang(i++, key);
}
Expand Down
Loading

0 comments on commit 971b3cc

Please sign in to comment.