Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarsten Thoms2017-09-12 19:11:29 +0000
committerAlexander Kurtakov2017-09-15 10:52:28 +0000
commit4b4a12be2c289e6a03ff0ef514af9271930652b8 (patch)
tree7de242ba30ac3a9137dc19be65cd4218977bcd6b /bundles/org.eclipse.swt.tools
parent181919e5b8cdbec2c1f51f16259e108bc6061c68 (diff)
downloadeclipse.platform.swt-4b4a12be2c289e6a03ff0ef514af9271930652b8.tar.gz
eclipse.platform.swt-4b4a12be2c289e6a03ff0ef514af9271930652b8.tar.xz
eclipse.platform.swt-4b4a12be2c289e6a03ff0ef514af9271930652b8.zip
Bug 522210 - Resolved inefficient use of keySet iteratorI20170915-1030
Change-Id: I79571322f6af34ebab6ef25d6ee0df7fe5a1d5b9 Signed-off-by: Karsten Thoms <karsten.thoms@itemis.de>
Diffstat (limited to 'bundles/org.eclipse.swt.tools')
-rw-r--r--bundles/org.eclipse.swt.tools/JavadocBasher/org/eclipse/swt/tools/internal/JavadocBasher.java17
-rw-r--r--bundles/org.eclipse.swt.tools/Mac Generation/org/eclipse/swt/tools/internal/MacGenerator.java21
2 files changed, 19 insertions, 19 deletions
diff --git a/bundles/org.eclipse.swt.tools/JavadocBasher/org/eclipse/swt/tools/internal/JavadocBasher.java b/bundles/org.eclipse.swt.tools/JavadocBasher/org/eclipse/swt/tools/internal/JavadocBasher.java
index 5bb77065fd..c611452bbe 100644
--- a/bundles/org.eclipse.swt.tools/JavadocBasher/org/eclipse/swt/tools/internal/JavadocBasher.java
+++ b/bundles/org.eclipse.swt.tools/JavadocBasher/org/eclipse/swt/tools/internal/JavadocBasher.java
@@ -2,6 +2,7 @@ package org.eclipse.swt.tools.internal;
import java.io.*;
import java.util.*;
+import java.util.Map.*;
import org.eclipse.jdt.core.dom.*;
import org.eclipse.jface.text.*;
@@ -9,7 +10,7 @@ import org.eclipse.jface.text.*;
/**
* Bashes the javadoc from one source tree into another. Only produces new
* source files for compilation units that have changed.
- *
+ *
* How to use: 1) make sure you have the latest org.eclipse.swt (master branch)
* in your workspace, and that you have no outstanding org.eclipse.swt changes
* 2) create a Bugzilla bug called
@@ -30,7 +31,7 @@ import org.eclipse.jface.text.*;
* before a javadoc comment) 10) use the Bugzilla bug as the commit comment for
* javadoc and copyright bash commits 11) make a version of the org.eclipse.swt
* project after bashing (use tag name AFTER_...)
- *
+ *
* 12) Copyright bash (tag before and after): NOTE: JavadocBasher does not fix
* copyrights. Use the "Fix Copyrights" tool in org.eclipse.releng.tools for
* that (always fix copyrights after bash). Use Help->Install New Software... to
@@ -52,7 +53,7 @@ import org.eclipse.jface.text.*;
* internal/mozilla have 2 copyright lines and the tool tries to change the 1st
* - don't keep the 1st change (Netscape 1998-2015), but update the 2nd (IBM)
* manually.
- *
+ *
* NOTE: JavadocBasher now does a fairly good job of checking API consistency.
* We used to use org.eclipse.swt.diff for API consistency checking, but it was
* difficult to maintain.
@@ -417,14 +418,14 @@ public class JavadocBasher {
"Display.getSystemFont",
"Display.msg",
"Menu.handle",
- "Shell.win32_newDisplaylong",
+ "Shell.win32_newDisplaylong",
"Accessible.internal_WM_GETOBJECTlonglong",
"TransferData.result",
"TransferData.stgmedium",
"TransferData.pIDataObject",
"TransferData.formatetc",
"Printer.handle",
- "Printer.checkDevice",
+ "Printer.checkDevice",
"TableDragSourceEffect.dragFinishedDragSourceEvent",
"TableDragSourceEffect.dragStartDragSourceEvent",
"TableDropTargetEffect.dragOverDropTargetEvent",
@@ -448,9 +449,9 @@ public class JavadocBasher {
"Display.getClientArea",
"TreeItem.handle",
};
- for (Iterator<String> iterator = comments.keySet().iterator(); iterator.hasNext();) {
- String name = iterator.next();
- if (comments.get(name).length() > 0){
+ for (Entry<String, String> entry: comments.entrySet()) {
+ String name = entry.getKey();
+ if (entry.getValue().length() > 0){
int i = 0;
for (i = 0; i < filter.length; i++) {
if (name.equals(filter[i])) break;
diff --git a/bundles/org.eclipse.swt.tools/Mac Generation/org/eclipse/swt/tools/internal/MacGenerator.java b/bundles/org.eclipse.swt.tools/Mac Generation/org/eclipse/swt/tools/internal/MacGenerator.java
index 5454db574b..0ed59815c6 100644
--- a/bundles/org.eclipse.swt.tools/Mac Generation/org/eclipse/swt/tools/internal/MacGenerator.java
+++ b/bundles/org.eclipse.swt.tools/Mac Generation/org/eclipse/swt/tools/internal/MacGenerator.java
@@ -12,6 +12,7 @@ package org.eclipse.swt.tools.internal;
import java.io.*;
import java.util.*;
+import java.util.Map.*;
import java.util.stream.*;
import javax.xml.parsers.*;
@@ -702,15 +703,14 @@ void generateClasses() {
TreeMap<String, Object[]> classes = getGeneratedClasses();
copyClassMethodsDown(classes);
- Set<String> classNames = classes.keySet();
- for (Iterator<String> iterator = classNames.iterator(); iterator.hasNext();) {
+ for (Entry<String, Object[]> clazzes: classes.entrySet()) {
CharArrayWriter out = new CharArrayWriter();
this.out = new PrintWriter(out);
out(fixDelimiter(metaData.getCopyright()));
- String className = iterator.next();
- Object[] clazz = classes.get(className);
+ String className = clazzes.getKey();
+ Object[] clazz = clazzes.getValue();
Node node = (Node)clazz[0];
ArrayList<?> methods = (ArrayList<?>)clazz[1];
out("package ");
@@ -742,15 +742,14 @@ void generateStructs() {
MetaData metaData = new MetaData(mainClassName);
TreeMap<String, Object[]> structs = getGeneratedStructs();
- Set<String> structNames = structs.keySet();
- for (Iterator<String> iterator = structNames.iterator(); iterator.hasNext();) {
+ for (Entry<String, Object[]> structEntry: structs.entrySet()) {
CharArrayWriter out = new CharArrayWriter();
this.out = new PrintWriter(out);
out(fixDelimiter(metaData.getCopyright()));
- String className = iterator.next();
- Object[] clazz = structs.get(className);
+ String className = structEntry.getKey();
+ Object[] clazz = structEntry.getValue();
ArrayList<?> methods = (ArrayList<?>)clazz[1];
out("package ");
String packageName = getPackageName(mainClassName);
@@ -1524,9 +1523,9 @@ void generateCustomCallbacks() {
}
}
}
- for (Iterator<String> iterator = set.keySet().iterator(); iterator.hasNext();) {
- String key = iterator.next();
- Node method = set.get(key);
+ for (Entry<String, Node> entry: set.entrySet()) {
+ String key = entry.getKey();
+ Node method = entry.getValue();
if ("informal_protocol".equals(method.getParentNode().getNodeName())) {
method = findNSObjectMethod(method);
if (method == null) continue;

Back to the top