Skip to content

Commit

Permalink
[NETBEANS-4002] - clean Iterator raw types
Browse files Browse the repository at this point in the history
This change removes the majority of these warnings..

This bug implements changes that clean a whole lot of Iterator raw type warning messages from the compiler..

   [repeat] /home/bwalker/src/netbeans/java/xml.tools.java/src/org/netbeans/modules/xml/tools/java/generator/ElementBindings.java:156: warning: [rawtypes] found
 raw type: Iterator
   [repeat]         Iterator it = values().iterator();
   [repeat]         ^
   [repeat]   missing type arguments for generic class Iterator<E>
   [repeat]   where E is a type-variable:
   [repeat]     E extends Object declared in interface Iterator

This change removes the majority of these warnings..
  • Loading branch information
Brad Walker committed Mar 11, 2020
1 parent 5594d85 commit 3b6d87d
Show file tree
Hide file tree
Showing 101 changed files with 336 additions and 332 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -342,10 +342,10 @@ protected Node[] createNodes(String loc) {

private void refreshKeys() {
List<String> newVisibleFiles = new ArrayList<String>();
Iterator it = FILES.keySet().iterator();
Iterator<String> it = FILES.keySet().iterator();
Set<FileObject> files = new HashSet<FileObject>();
while (it.hasNext()) {
String loc = (String) it.next();
String loc = it.next();
String locEval = project.getEvaluator().evaluate(loc);
if (locEval == null) {
continue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -296,8 +296,8 @@ public void showJavadoc() {
private static URL[] getJavadocRoots(JavaPlatform platform) {
Set<URL> result = new HashSet<URL>();
List<ClassPath.Entry> l = platform.getBootstrapLibraries().entries();
for (Iterator it = l.iterator(); it.hasNext();) {
ClassPath.Entry e = (ClassPath.Entry) it.next();
for (Iterator<ClassPath.Entry> it = l.iterator(); it.hasNext();) {
ClassPath.Entry e = it.next();
result.addAll(Arrays.asList(JavadocForBinaryQuery.findJavadoc(e.getURL()).getRoots()));
}
return result.toArray(new URL[result.size()]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -429,8 +429,8 @@ boolean dependingOnImplDependency() {
return false;
}
Set<ModuleDependency> deps = depsModel.getDependencies();
for (Iterator it = deps.iterator(); it.hasNext();) {
ModuleDependency dep = (ModuleDependency) it.next();
for (Iterator<ModuleDependency> it = deps.iterator(); it.hasNext();) {
ModuleDependency dep = it.next();
if (dep.hasImplementationDependency()) {
return true;
}
Expand Down Expand Up @@ -741,17 +741,17 @@ static String clusterBaseName(String clusterName) {
String[] getAvailableFriends() {
SortedSet<String> set = new TreeSet<String>();
if (isSuiteComponent()) {
for (Iterator it = SuiteUtils.getSubProjects(getSuite()).iterator(); it.hasNext();) {
Project prj = (Project) it.next();
for (Iterator<NbModuleProject> it = SuiteUtils.getSubProjects(getSuite()).iterator(); it.hasNext();) {
Project prj = it.next();
String cnb = ProjectUtils.getInformation(prj).getName();
if (!getCodeNameBase().equals(cnb)) {
set.add(cnb);
}
}
} else if (isNetBeansOrg()) {
Set<ModuleDependency> deps = getUniverseDependencies(false);
for (Iterator it = deps.iterator(); it.hasNext();) {
ModuleDependency dep = (ModuleDependency) it.next();
for (Iterator<ModuleDependency> it = deps.iterator(); it.hasNext();) {
ModuleDependency dep = it.next();
set.add(dep.getModuleEntry().getCodeNameBase());
}
} // else standalone module - leave empty (see the UI spec)
Expand Down Expand Up @@ -901,8 +901,8 @@ private Collection<String> getSelectedPackages() {
for (int i = 0; i < pexports.length; i++) {
ManifestManager.PackageExport pexport = pexports[i];
if (pexport.isRecursive()) {
for (Iterator it = getAvailablePublicPackages().iterator(); it.hasNext(); ) {
String p = (String) it.next();
for (Iterator<String> it = getAvailablePublicPackages().iterator(); it.hasNext(); ) {
String p = it.next();
if (p.startsWith(pexport.getPackage())) {
sPackages.add(p);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,9 @@ protected final void scanJarForPublicClassNames(Set<String> result, File jar) th
String pkg = path.substring(0, slash + 1);
if (!publicPackagesSlashNonRec.contains(pkg)) {
boolean pub = false;
Iterator it = publicPackagesSlashRec.iterator();
Iterator<String> it = publicPackagesSlashRec.iterator();
while (it.hasNext()) {
if (pkg.startsWith((String) it.next())) {
if (pkg.startsWith(it.next())) {
pub = true;
break;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -455,9 +455,9 @@ public Set<String> getAttributeNames() {
}

public void write(Writer w, boolean forceBlankLine) throws IOException {
Iterator it = lines.iterator();
Iterator<Line> it = lines.iterator();
while (it.hasNext()) {
Line line = (Line) it.next();
Line line = it.next();
line.write(w);
}
for (int i = 0; i < blankLinesAfter; i++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ private TreeElement getRootElement() {
if (doc == null) {
return null;
}
Iterator it;
Iterator<?> it;
it = doc.getChildNodes().iterator();
while (it.hasNext()) {
Object next = it.next();
Expand Down Expand Up @@ -195,9 +195,9 @@ private static TreeElement findElementIn(TreeElement el, String name) {
remainder = name.substring(idx + 1);
}
TreeElement subel = null;
Iterator it = el.getChildNodes(TreeElement.class).iterator();
Iterator<TreeElement> it = el.getChildNodes(TreeElement.class).iterator();
while (it.hasNext()) {
TreeElement e = (TreeElement) it.next();
TreeElement e = it.next();
if (e.getLocalName().equals("file") || // NOI18N
e.getLocalName().equals("folder")) { // NOI18N
TreeAttribute nameAttr = e.getAttribute("name"); // NOI18N
Expand Down Expand Up @@ -233,9 +233,9 @@ public String[] children(String f) {
}
ArrayList<String> kids = new ArrayList<String>();
Set<String> allNames = new HashSet<String>();
Iterator it = el.getChildNodes(TreeElement.class).iterator();
Iterator<TreeElement> it = el.getChildNodes(TreeElement.class).iterator();
while (it.hasNext()) {
TreeElement sub = (TreeElement) it.next();
TreeElement sub = it.next();
if (sub.getLocalName().equals("file") || // NOI18N
sub.getLocalName().equals("folder")) { // NOI18N
TreeAttribute childName = sub.getAttribute("name"); // NOI18N
Expand Down Expand Up @@ -296,7 +296,7 @@ private byte[] getContentsOf(final String name) throws FileNotFoundException {
}
} else {
StringBuffer buf = new StringBuffer();
Iterator it = el.getChildNodes().iterator();
Iterator<?> it = el.getChildNodes().iterator();
while (it.hasNext()) {
Object o = it.next();
if (o instanceof TreeCDATASection) {
Expand Down Expand Up @@ -560,9 +560,9 @@ public Enumeration<String> attributes(String name) {
return Enumerations.empty();
}
java.util.List<String> l = new ArrayList<String>(10);
Iterator it = el.getChildNodes(TreeElement.class).iterator();
Iterator<TreeElement> it = el.getChildNodes(TreeElement.class).iterator();
while (it.hasNext()) {
TreeElement sub = (TreeElement) it.next();
TreeElement sub = it.next();
if (sub.getLocalName().equals("attr")) { // NOI18N
TreeAttribute nameAttr = sub.getAttribute("name"); // NOI18N
if (nameAttr == null) {
Expand Down Expand Up @@ -836,9 +836,9 @@ public void writeAttribute(String name, String attrName, Object v) throws IOExce
}
// Find any existing <attr>.
TreeChild existingAttr = null;
Iterator it = el.getChildNodes(TreeElement.class).iterator();
Iterator<TreeElement> it = el.getChildNodes(TreeElement.class).iterator();
while (it.hasNext()) {
TreeElement sub = (TreeElement) it.next();
TreeElement sub = it.next();
if (sub.getLocalName().equals("attr")) { // NOI18N
TreeAttribute attr = sub.getAttribute("name"); // NOI18N
if (attr == null) {
Expand Down Expand Up @@ -1150,9 +1150,9 @@ private static TreeChild insertBefore(TreeElement parent, TreeChild child) throw
TreeElement childe = (TreeElement) child;
if (childe.getQName().equals("file") || childe.getQName().equals("folder")) { // NOI18N
String name = childe.getAttribute("name").getValue(); // NOI18N
Iterator it = parent.getChildNodes(TreeElement.class).iterator();
Iterator<TreeElement> it = parent.getChildNodes(TreeElement.class).iterator();
while (it.hasNext()) {
TreeElement kid = (TreeElement) it.next();
TreeElement kid = it.next();
if (kid.getQName().equals("file") || kid.getQName().equals("folder")) { // NOI18N
TreeAttribute attr = kid.getAttribute("name"); // NOI18N
if (attr != null) { // #66816 - layer might be malformed
Expand All @@ -1166,9 +1166,9 @@ private static TreeChild insertBefore(TreeElement parent, TreeChild child) throw
return null;
} else if (childe.getQName().equals("attr")) { // NOI18N
String name = childe.getAttribute("name").getValue(); // NOI18N
Iterator it = parent.getChildNodes(TreeElement.class).iterator();
Iterator<TreeElement> it = parent.getChildNodes(TreeElement.class).iterator();
while (it.hasNext()) {
TreeElement kid = (TreeElement) it.next();
TreeElement kid = it.next();
if (kid.getQName().equals("file") || kid.getQName().equals("folder")) { // NOI18N
return kid;
} else if (kid.getQName().equals("attr")) { // NOI18N
Expand Down Expand Up @@ -1337,7 +1337,7 @@ private static void deleteWithIndent(TreeChild child) throws ReadOnlyException {
TreeElement parent = (TreeElement) child.getParentNode();
TreeObjectList list = parent.getChildNodes();
boolean kill = true;
Iterator it = list.iterator();
Iterator<?> it = list.iterator();
while (it.hasNext()) {
Object o = it.next();
if (o == child) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,8 @@ private BrandedFile getBrandedFile(final BrandableModule moduleEntry, final Stri
BrandedFile retval = null;
try {
retval = new BrandedFile(moduleEntry, entryPath);
for (Iterator it = getBrandedFiles().iterator();it.hasNext() ;) {
BrandedFile bFile = (BrandedFile)it.next();
for (Iterator<BrandedFile> it = getBrandedFiles().iterator();it.hasNext() ;) {
BrandedFile bFile = it.next();

if (retval.equals(bFile)) {
retval = bFile;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ public void updateKeys(){
Hk2ItemNode.WS_FOLDER));
}
List<Node> pluggableNodes = getExtensionNodes();
for (Iterator itr = pluggableNodes.iterator(); itr.hasNext();) {
keys.add((Node)itr.next());
for (Iterator<Node> itr = pluggableNodes.iterator(); itr.hasNext();) {
keys.add(itr.next());
}
}
setKeys(keys);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.net.URL;
import java.util.Iterator;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.netbeans.modules.j2ee.dd.api.web.DDProvider;
Expand Down Expand Up @@ -442,11 +443,11 @@ private static String getInternalServerPort() {
private static void startModuleSpy (final ModuleSpy spy) {
// trying to hang a listener on monitor module
res = Lookup.getDefault().lookup(new Lookup.Template<ModuleInfo>(ModuleInfo.class));
java.util.Iterator it = res.allInstances ().iterator ();
Iterator<ModuleInfo> it = res.allInstances ().iterator ();
final String moduleId = spy.getModuleId();
// boolean found = false;
while (it.hasNext ()) {
org.openide.modules.ModuleInfo mi = (ModuleInfo)it.next ();
org.openide.modules.ModuleInfo mi = it.next();
if (mi.getCodeName ().startsWith(moduleId)) {
httpMonitorInfo=mi;
spy.setEnabled(mi.isEnabled());
Expand Down Expand Up @@ -525,10 +526,10 @@ private static class MonitorLookupListener implements LookupListener {

@Override
public void resultChanged(LookupEvent lookupEvent) {
java.util.Iterator it = res.allInstances ().iterator ();
Iterator<ModuleInfo> it = res.allInstances().iterator();
boolean moduleFound=false;
while (it.hasNext ()) {
ModuleInfo mi = (ModuleInfo)it.next ();
ModuleInfo mi = it.next();
if (mi.getCodeName ().startsWith(spy.getModuleId())) {
spy.setEnabled(mi.isEnabled());
if (httpMonitorInfo==null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,9 @@ private static Map<String, String> checkResources(ResourceFinder resourceFinder,
Map<String, String> localData = resourceFinder.getResourceData().get(jndiName);
String remoteKey = prefix + jndiName + "."; // NOI18N
Map<String, String> remoteData = new HashMap<String, String>();
Iterator itr = allRemoteData.keySet().iterator();
Iterator<String> itr = allRemoteData.keySet().iterator();
while (itr.hasNext()) {
String key = (String) itr.next();
String key = itr.next();
if(key.startsWith(remoteKey)){
remoteData.put(key, allRemoteData.get(key));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ public void updateKeys(){
Hk2ItemNode.WS_FOLDER));
}
List<Node> pluggableNodes = getExtensionNodes();
for (Iterator itr = pluggableNodes.iterator(); itr.hasNext();) {
keys.add((Node)itr.next());
for (Iterator<Node> itr = pluggableNodes.iterator(); itr.hasNext();) {
keys.add(itr.next());
}
}
setKeys(keys);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.net.URL;
import java.util.Iterator;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.netbeans.modules.j2ee.dd.api.web.DDProvider;
Expand Down Expand Up @@ -442,11 +443,11 @@ private static String getInternalServerPort() {
private static void startModuleSpy (final ModuleSpy spy) {
// trying to hang a listener on monitor module
res = Lookup.getDefault().lookup(new Lookup.Template<ModuleInfo>(ModuleInfo.class));
java.util.Iterator it = res.allInstances ().iterator ();
Iterator<ModuleInfo> it = res.allInstances().iterator();
final String moduleId = spy.getModuleId();
// boolean found = false;
while (it.hasNext ()) {
org.openide.modules.ModuleInfo mi = (ModuleInfo)it.next ();
org.openide.modules.ModuleInfo mi = it.next();
if (mi.getCodeName ().startsWith(moduleId)) {
httpMonitorInfo=mi;
spy.setEnabled(mi.isEnabled());
Expand Down Expand Up @@ -525,10 +526,10 @@ private static class MonitorLookupListener implements LookupListener {

@Override
public void resultChanged(LookupEvent lookupEvent) {
java.util.Iterator it = res.allInstances ().iterator ();
Iterator<ModuleInfo> it = res.allInstances().iterator();
boolean moduleFound=false;
while (it.hasNext ()) {
ModuleInfo mi = (ModuleInfo)it.next ();
ModuleInfo mi = it.next();
if (mi.getCodeName ().startsWith(spy.getModuleId())) {
spy.setEnabled(mi.isEnabled());
if (httpMonitorInfo==null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,9 @@ private static Map<String, String> checkResources(ResourceFinder resourceFinder,
Map<String, String> localData = resourceFinder.getResourceData().get(jndiName);
String remoteKey = prefix + jndiName + "."; // NOI18N
Map<String, String> remoteData = new HashMap<String, String>();
Iterator itr = allRemoteData.keySet().iterator();
Iterator<String> itr = allRemoteData.keySet().iterator();
while (itr.hasNext()) {
String key = (String) itr.next();
String key = itr.next();
if(key.startsWith(remoteKey)){
remoteData.put(key, allRemoteData.get(key));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -362,9 +362,9 @@ public void removeCatalogListener(CatalogListener l) {
}

public void fireCatalogListeners() {
Iterator iter = catalogListeners.iterator();
Iterator<CatalogListener> iter = catalogListeners.iterator();
while (iter.hasNext()) {
CatalogListener l = (CatalogListener) iter.next();
CatalogListener l = iter.next();
l.notifyInvalidate();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ public String getServerID() {
private void fireChange() {
if (changeListeners != null) {
ChangeEvent e = new ChangeEvent(this);
for (Iterator i = changeListeners.iterator(); i.hasNext(); ) {
((ChangeListener) i.next()).stateChanged(e);
for (Iterator<ChangeListener> i = changeListeners.iterator(); i.hasNext(); ) {
i.next().stateChanged(e);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,9 @@ public void modify(String webServiceId) {

public void setWebServiceIds(Set ids){
webserviceIds = ids;
Iterator iter = webserviceIds.iterator();
Iterator<String> iter = webserviceIds.iterator();
while(iter.hasNext()) {
WebServiceData wsData = WebServiceListModel.getInstance().getWebService((String)iter.next());
WebServiceData wsData = WebServiceListModel.getInstance().getWebService(iter.next());
wsData.setGroupId(getId());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,10 +236,10 @@ public void removeWebServiceGroup(String groupId) {
WebServiceManager.getInstance().removeWebService(getWebService(webserviceIds[ii]));
}
webServiceGroups.remove(group);
Iterator iter = listeners.iterator();
Iterator<WebServiceListModelListener> iter = listeners.iterator();
while (iter.hasNext()) {
WebServiceListModelEvent evt = new WebServiceListModelEvent(groupId);
((WebServiceListModelListener) iter.next()).webServiceGroupRemoved(evt);
iter.next().webServiceGroupRemoved(evt);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -696,9 +696,9 @@ public void registerListener(MethodTaskListener inListener) {
}

private void notifyListeners(Object returnedObject) {
Iterator listenerIterator = listeners.iterator();
Iterator<MethodTaskListener> listenerIterator = listeners.iterator();
while(listenerIterator.hasNext()) {
MethodTaskListener currentListener = (MethodTaskListener)listenerIterator.next();
MethodTaskListener currentListener = listenerIterator.next();
currentListener.methodFinished(returnedObject, paramList);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -392,8 +392,8 @@ private void genEnumFields(List fields, PrintWriter out) {
}
boolean first = true;

for (Iterator iterator = fields.iterator(); iterator.hasNext();) {
FieldNode fieldNode = (FieldNode) iterator.next();
for (Iterator<FieldNode> iterator = fields.iterator(); iterator.hasNext();) {
FieldNode fieldNode = iterator.next();
if (!first) {
out.print(", ");
} else {
Expand Down
Loading

0 comments on commit 3b6d87d

Please sign in to comment.