Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeo Ufimtsev2018-05-16 16:37:47 -0400
committerLeo Ufimtsev2018-05-16 17:10:26 -0400
commitd451e52002aeb6e27e59809d60ef18043a768b70 (patch)
tree6746f189b6761a6312feda5305ba2524924f45b9
parent9d334185fde44514da763f3766f9c872d149ab51 (diff)
downloadeclipse.platform.swt-d451e52002aeb6e27e59809d60ef18043a768b70.tar.gz
eclipse.platform.swt-d451e52002aeb6e27e59809d60ef18043a768b70.tar.xz
eclipse.platform.swt-d451e52002aeb6e27e59809d60ef18043a768b70.zip
Bug 534783 – SWT tools isn't rebuilding natives after foreach patch
Revert "For each conversion in swt.tools." This reverts commit 9a92da14a27e579409c00ff3eefd197eac4209da. https://bugs.eclipse.org/bugs/show_bug.cgi?id=534783 Change-Id: I464b41bdc9bdd125b1f56b501e226fb89ceca310 Signed-off-by: Leo Ufimtsev <lufimtse@redhat.com>
-rw-r--r--bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/ASTClass.java19
-rw-r--r--bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/ASTField.java2
-rw-r--r--bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/ASTMethod.java6
-rw-r--r--bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/AbstractItem.java7
-rw-r--r--bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/CleanupClass.java3
-rw-r--r--bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/CleanupConstants.java5
-rw-r--r--bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/CleanupNatives.java5
-rw-r--r--bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/ConstantsGenerator.java10
-rw-r--r--bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/EmbedMetaData.java6
-rw-r--r--bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/JNIGenerator.java12
-rw-r--r--bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/JNIGeneratorApp.java23
-rw-r--r--bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/JNIGeneratorAppUI.java36
-rw-r--r--bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/MetaDataGenerator.java8
-rw-r--r--bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/NativesGenerator.java17
-rw-r--r--bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/ReflectField.java2
-rw-r--r--bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/ReflectMethod.java5
-rw-r--r--bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/SizeofGenerator.java10
-rw-r--r--bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/StatsGenerator.java10
-rw-r--r--bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/StructsGenerator.java20
-rw-r--r--bundles/org.eclipse.swt.tools/JavadocBasher/org/eclipse/swt/tools/internal/JavadocBasher.java2
-rw-r--r--bundles/org.eclipse.swt.tools/Mac Generation/org/eclipse/swt/tools/internal/MacGenerator.java8
-rw-r--r--bundles/org.eclipse.swt.tools/Mac Generation/org/eclipse/swt/tools/internal/MacGeneratorUI.java66
-rw-r--r--bundles/org.eclipse.swt.tools/NativeStats/org/eclipse/swt/tools/internal/NativeStats.java11
23 files changed, 177 insertions, 116 deletions
diff --git a/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/ASTClass.java b/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/ASTClass.java
index e54221e232..a642b92ed9 100644
--- a/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/ASTClass.java
+++ b/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/ASTClass.java
@@ -37,8 +37,8 @@ public class ASTClass extends ASTItem implements JNIClass {
if (file.exists()) {
return file.getAbsolutePath();
}
- for (String import1 : imports) {
- file = new File(basePath + import1.replace('.', '/') + "/" + simpleName + ".java");
+ for (int i = 0; i < imports.length; i++) {
+ file = new File(basePath + imports[i].replace('.', '/') + "/" + simpleName + ".java");
if (file.exists()) {
return file.getAbsolutePath();
}
@@ -53,10 +53,10 @@ public class ASTClass extends ASTItem implements JNIClass {
if (file.exists()) {
return packageName + "." + simpleName;
}
- for (String import1 : imports) {
- file = new File(basePath + import1.replace('.', '/') + "/" + simpleName + ".java");
+ for (int i = 0; i < imports.length; i++) {
+ file = new File(basePath + imports[i].replace('.', '/') + "/" + simpleName + ".java");
if (file.exists()) {
- return import1 + "." + simpleName;
+ return imports[i] + "." + simpleName;
}
}
return simpleName;
@@ -99,7 +99,8 @@ public ASTClass(String sourcePath, MetaData metaData) {
FieldDeclaration[] fields = type.getFields();
List<ASTField> fid = new ArrayList<>();
- for (FieldDeclaration field : fields) {
+ for (int i = 0; i < fields.length; i++) {
+ FieldDeclaration field = fields[i];
List<VariableDeclarationFragment> fragments = field.fragments();
for (VariableDeclarationFragment fragment : fragments) {
fid.add(new ASTField(this, source, field, fragment));
@@ -108,9 +109,9 @@ public ASTClass(String sourcePath, MetaData metaData) {
this.fields = fid.toArray(new ASTField[fid.size()]);
MethodDeclaration[] methods = type.getMethods();
List<ASTMethod> mid = new ArrayList<>();
- for (MethodDeclaration method : methods) {
- if (method.getReturnType2() == null) continue;
- mid.add(new ASTMethod(this, source, method));
+ for (int i = 0; i < methods.length; i++) {
+ if (methods[i].getReturnType2() == null) continue;
+ mid.add(new ASTMethod(this, source, methods[i]));
}
this.methods = mid.toArray(new ASTMethod[mid.size()]);
}
diff --git a/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/ASTField.java b/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/ASTField.java
index 4427e75731..1f490d200c 100644
--- a/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/ASTField.java
+++ b/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/ASTField.java
@@ -100,7 +100,7 @@ public String getAccessor() {
@Override
public String getCast() {
String cast = ((String)getParam("cast")).trim();
- if (!cast.isEmpty()) {
+ if (cast.length() > 0) {
if (!cast.startsWith("(")) cast = "(" + cast;
if (!cast.endsWith(")")) cast = cast + ")";
}
diff --git a/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/ASTMethod.java b/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/ASTMethod.java
index c251dc5745..a8cd8ce367 100644
--- a/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/ASTMethod.java
+++ b/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/ASTMethod.java
@@ -64,7 +64,8 @@ public ASTMethod(ASTClass declaringClass, String source, MethodDeclaration metho
paramTypes64 = new ASTType[parameters.size()];
this.parameters = new ASTParameter[paramTypes.length];
int i = 0;
- for (SingleVariableDeclaration param : parameters) {
+ for (Iterator<SingleVariableDeclaration> iterator = parameters.iterator(); iterator.hasNext(); i++) {
+ SingleVariableDeclaration param = iterator.next();
paramTypes[i] = new ASTType(declaringClass.resolver, param.getType(), param.getExtraDimensions());
paramTypes64[i] = paramTypes[i];
this.parameters[i] = new ASTParameter(this, i, param.getName().getIdentifier());
@@ -115,7 +116,8 @@ public boolean isNativeUnique() {
boolean result = true;
String name = getName();
JNIMethod[] methods = declaringClass.getDeclaredMethods();
- for (JNIMethod mth : methods) {
+ for (int i = 0; i < methods.length; i++) {
+ JNIMethod mth = methods[i];
if ((mth.getModifiers() & Modifier.NATIVE) != 0 &&
this != mth && !this.equals(mth) &&
name.equals(mth.getName()))
diff --git a/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/AbstractItem.java b/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/AbstractItem.java
index bf40e0064d..181d347b4d 100644
--- a/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/AbstractItem.java
+++ b/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/AbstractItem.java
@@ -31,7 +31,8 @@ public String flatten() {
Set<String> set = params.keySet();
String[] keys = set.toArray(new String[set.size()]);
Arrays.sort(keys);
- for (String key : keys) {
+ for (int j = 0; j < keys.length; j++) {
+ String key = keys[j];
Object value = params.get(key);
String valueStr = "";
if (value instanceof String) {
@@ -76,8 +77,8 @@ public String[] getFlags() {
@Override
public boolean getFlag(String flag) {
String[] flags = getFlags();
- for (String flag2 : flags) {
- if (flag2.equals(flag)) return true;
+ for (int i = 0; i < flags.length; i++) {
+ if (flags[i].equals(flag)) return true;
}
return false;
}
diff --git a/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/CleanupClass.java b/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/CleanupClass.java
index fa768cdcf1..8f4cc1c977 100644
--- a/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/CleanupClass.java
+++ b/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/CleanupClass.java
@@ -99,7 +99,8 @@ void loadDirectory(File file) {
if (entries == null) {
entries = new String[0];
}
- for (String entry : entries) {
+ for (int i = 0; i < entries.length; i++) {
+ String entry = entries[i];
File f = new File(file, entry);
if (!f.isDirectory()) {
if (f.getAbsolutePath().endsWith(".java")) {
diff --git a/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/CleanupConstants.java b/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/CleanupConstants.java
index d0192c7b14..69b58d0608 100644
--- a/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/CleanupConstants.java
+++ b/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/CleanupConstants.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2018 IBM Corporation and others.
+ * Copyright (c) 2004, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -40,7 +40,8 @@ public void generate(JNIClass clazz) {
public void generate(JNIField[] fields) {
sort(fields);
- for (JNIField field : fields) {
+ for (int i = 0; i < fields.length; i++) {
+ JNIField field = fields[i];
if ((field.getModifiers() & Modifier.FINAL) == 0) continue;
generate(field);
}
diff --git a/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/CleanupNatives.java b/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/CleanupNatives.java
index 293f759c9f..db66465645 100644
--- a/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/CleanupNatives.java
+++ b/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/CleanupNatives.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2018 IBM Corporation and others.
+ * Copyright (c) 2004, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -29,7 +29,8 @@ public void generate(JNIClass clazz) {
public void generate(JNIMethod[] methods) {
sort(methods);
- for (JNIMethod method : methods) {
+ for (int i = 0; i < methods.length; i++) {
+ JNIMethod method = methods[i];
if ((method.getModifiers() & Modifier.NATIVE) == 0) continue;
generate(method);
}
diff --git a/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/ConstantsGenerator.java b/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/ConstantsGenerator.java
index 385371f676..8bce4db357 100644
--- a/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/ConstantsGenerator.java
+++ b/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/ConstantsGenerator.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2018 IBM Corporation and others.
+ * Copyright (c) 2004, 2013 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -10,7 +10,7 @@
*******************************************************************************/
package org.eclipse.swt.tools.internal;
-import java.lang.reflect.*;
+import java.lang.reflect.Modifier;
public class ConstantsGenerator extends JNIGenerator {
@@ -23,7 +23,8 @@ public void generate(JNIClass clazz) {
public void generate(JNIField[] fields) {
sort(fields);
outputln("int main() {");
- for (JNIField field : fields) {
+ for (int i = 0; i < fields.length; i++) {
+ JNIField field = fields[i];
if ((field.getModifiers() & Modifier.FINAL) == 0) continue;
generate(field);
}
@@ -51,7 +52,8 @@ public static void main(String[] args) {
}
try {
ConstantsGenerator gen = new ConstantsGenerator();
- for (String clazzName : args) {
+ for (int i = 0; i < args.length; i++) {
+ String clazzName = args[i];
Class<?> clazz = Class.forName(clazzName);
gen.generate(new ReflectClass(clazz));
}
diff --git a/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/EmbedMetaData.java b/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/EmbedMetaData.java
index 23694e775c..1c457c13ef 100644
--- a/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/EmbedMetaData.java
+++ b/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/EmbedMetaData.java
@@ -49,7 +49,8 @@ public void generate(JNIClass clazz) {
}
public void generate(JNIField[] fields) {
- for (JNIField field : fields) {
+ for (int i = 0; i < fields.length; i++) {
+ JNIField field = fields[i];
int mods = field.getModifiers();
if ((mods & Modifier.PUBLIC) == 0) continue;
if ((mods & Modifier.FINAL) != 0) continue;
@@ -69,7 +70,8 @@ public void generate(JNIField field) {
}
public void generate(JNIMethod[] methods) {
- for (JNIMethod method : methods) {
+ for (int i = 0; i < methods.length; i++) {
+ JNIMethod method = methods[i];
if ((method.getModifiers() & Modifier.NATIVE) == 0) continue;
generate(method);
}
diff --git a/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/JNIGenerator.java b/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/JNIGenerator.java
index 83557aabbe..110167a12d 100644
--- a/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/JNIGenerator.java
+++ b/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/JNIGenerator.java
@@ -131,7 +131,8 @@ static String getFunctionName(JNIMethod method, JNIType[] paramTypes) {
StringBuilder buffer = new StringBuilder();
buffer.append(function);
buffer.append("__");
- for (JNIType paramType : paramTypes) {
+ for (int i = 0; i < paramTypes.length; i++) {
+ JNIType paramType = paramTypes[i];
buffer.append(toC(paramType.getTypeSignature(false)));
}
return buffer.toString();
@@ -216,7 +217,8 @@ public void generate() {
generateAutoGenNote();
generateIncludes();
sort(classes);
- for (JNIClass clazz : classes) {
+ for (int i = 0; i < classes.length; i++) {
+ JNIClass clazz = classes[i];
if (getGenerate(clazz)) generate(clazz);
if (progress != null) progress.step();
}
@@ -236,7 +238,8 @@ public JNIClass[] getClasses() {
}
public boolean getCPP() {
- for (JNIClass clazz : classes) {
+ for (int i = 0; i < classes.length; i++) {
+ JNIClass clazz = classes[i];
if (clazz.getFlag(FLAG_CPP)) {
return true;
}
@@ -269,7 +272,8 @@ public String getOutputName() {
}
public boolean getM() {
- for (JNIClass clazz : classes) {
+ for (int i = 0; i < classes.length; i++) {
+ JNIClass clazz = classes[i];
if (clazz.getFlag(FLAG_M)) {
return true;
}
diff --git a/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/JNIGeneratorApp.java b/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/JNIGeneratorApp.java
index 6125715888..8a9ed8723d 100644
--- a/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/JNIGeneratorApp.java
+++ b/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/JNIGeneratorApp.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2018 IBM Corporation and others.
+ * Copyright (c) 2004, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -226,9 +226,11 @@ public void generate(ProgressMonitor progress) {
this.progress = progress;
if (progress != null) {
int nativeCount = 0;
- for (JNIClass clazz : natives) {
+ for (int i = 0; i < natives.length; i++) {
+ JNIClass clazz = natives[i];
JNIMethod[] methods = clazz.getDeclaredMethods();
- for (JNIMethod method : methods) {
+ for (int j = 0; j < methods.length; j++) {
+ JNIMethod method = methods[j];
if ((method.getModifiers() & Modifier.NATIVE) == 0) continue;
nativeCount++;
}
@@ -297,7 +299,8 @@ String[] getClassNames() {
if(entries == null) {
entries = new String[0];
}
- for (String entry : entries) {
+ for (int i = 0; i < entries.length; i++) {
+ String entry = entries[i];
File f = new File(file, entry);
if (!f.isDirectory()) {
if (f.getAbsolutePath().endsWith(".class")) {
@@ -351,7 +354,8 @@ JNIClass[] getASTClasses() {
if (files == null) {
files = new File[0];
}
- for (File file : files) {
+ for (int i = 0; i < files.length; i++) {
+ File file = files[i];
try {
String path = file.getAbsolutePath().replace('\\', '/');
if (path.endsWith(".java")) {
@@ -377,9 +381,11 @@ JNIClass[] getASTClasses() {
public JNIClass[] getNativesClasses(JNIClass[] classes) {
if (mainClass == null) return new JNIClass[0];
List<JNIClass> result = new ArrayList<>();
- for (JNIClass clazz : classes) {
+ for (int i = 0; i < classes.length; i++) {
+ JNIClass clazz = classes[i];
JNIMethod[] methods = clazz.getDeclaredMethods();
- for (JNIMethod method : methods) {
+ for (int j = 0; j < methods.length; j++) {
+ JNIMethod method = methods[j];
int mods = method.getModifiers();
if ((mods & Modifier.NATIVE) != 0) {
result.add(clazz);
@@ -404,7 +410,8 @@ public JNIClass[] getStructureClasses(JNIClass[] classes) {
}
JNIField[] fields = clazz.getDeclaredFields();
boolean hasPublicFields = false;
- for (JNIField field : fields) {
+ for (int j = 0; j < fields.length; j++) {
+ JNIField field = fields[j];
int mods = field.getModifiers();
if ((mods & Modifier.PUBLIC) != 0 && (mods & Modifier.STATIC) == 0) {
hasPublicFields = true;
diff --git a/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/JNIGeneratorAppUI.java b/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/JNIGeneratorAppUI.java
index 21274bd229..7a0834b38b 100644
--- a/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/JNIGeneratorAppUI.java
+++ b/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/JNIGeneratorAppUI.java
@@ -152,7 +152,8 @@ void generateAll() {
shell.setCursor(cursor);
shell.setEnabled(false);
Control[] children = actionsPanel.getChildren();
- for (Control child : children) {
+ for (int i = 0; i < children.length; i++) {
+ Control child = children[i];
if (child instanceof Button) child.setEnabled(false);
}
boolean showProgress = true;
@@ -200,7 +201,8 @@ void generateAll() {
while (!done[0]) {
if (!display.readAndDispatch()) display.sleep();
}
- for (Control child : children) {
+ for (int i = 0; i < children.length; i++) {
+ Control child = children[i];
if (child instanceof Button) child.setEnabled(true);
}
if (showProgress) {
@@ -238,7 +240,8 @@ JNIMethod[] getSelectedMethods() {
TableItem[] selection = membersLt.getSelection();
JNIMethod[] methods = new JNIMethod[selection.length];
int count = 0;
- for (TableItem item : selection) {
+ for (int i = 0; i < selection.length; i++) {
+ TableItem item = selection [i];
Object data = item.getData();
if (data instanceof JNIMethod) {
methods[count++] = (JNIMethod)data;
@@ -256,7 +259,8 @@ JNIField[] getSelectedFields() {
TableItem[] selection = membersLt.getSelection();
JNIField[] fields = new JNIField[selection.length];
int count = 0;
- for (TableItem item : selection) {
+ for (int i = 0; i < selection.length; i++) {
+ TableItem item = selection [i];
Object data = item.getData();
if (data instanceof JNIField) {
fields[count++] = (JNIField)data;
@@ -911,7 +915,8 @@ String getClassString(JNIType type) {
String getFlagsString(String[] flags) {
if (flags.length == 0) return "";
StringBuilder buffer = new StringBuilder();
- for (String flag : flags) {
+ for (int j = 0; j < flags.length; j++) {
+ String flag = flags[j];
if (buffer.length() != 0) buffer.append(", ");
buffer.append(flag);
}
@@ -953,7 +958,8 @@ void updateClasses() {
item.setChecked(clazz.getGenerate());
}
TableColumn[] columns = classesLt.getColumns();
- for (TableColumn column : columns) {
+ for (int i = 0; i < columns.length; i++) {
+ TableColumn column = columns[i];
column.pack();
}
classesLt.setSelection(mainIndex);
@@ -963,7 +969,8 @@ void updateMembers() {
membersLt.removeAll();
membersLt.setHeaderVisible(false);
TableColumn[] columns = membersLt.getColumns();
- for (TableColumn column : columns) {
+ for (int i = 0; i < columns.length; i++) {
+ TableColumn column = columns[i];
column.dispose();
}
int[] indices = classesLt.getSelectionIndices();
@@ -972,7 +979,8 @@ void updateMembers() {
JNIClass clazz = (JNIClass)classItem.getData();
boolean hasNatives = false;
JNIMethod[] methods = clazz.getDeclaredMethods();
- for (JNIMethod method : methods) {
+ for (int i = 0; i < methods.length; i++) {
+ JNIMethod method = methods[i];
int mods = method.getModifiers();
if (hasNatives =((mods & Modifier.NATIVE) != 0)) break;
}
@@ -990,7 +998,8 @@ void updateMembers() {
column.setText("Exclude");
*/
JNIGenerator.sort(methods);
- for (JNIMethod method : methods) {
+ for (int i = 0; i < methods.length; i++) {
+ JNIMethod method = methods[i];
if ((method.getModifiers() & Modifier.NATIVE) == 0) continue;
TableItem item = new TableItem(membersLt, SWT.NONE);
item.setData(method);
@@ -1017,7 +1026,8 @@ void updateMembers() {
column.setText("Exclude");
*/
JNIField[] fields = clazz.getDeclaredFields();
- for (JNIField field : fields) {
+ for (int i = 0; i < fields.length; i++) {
+ JNIField field = fields[i];
int mods = field.getModifiers();
if (((mods & Modifier.PUBLIC) == 0) ||
((mods & Modifier.FINAL) != 0) ||
@@ -1035,7 +1045,8 @@ void updateMembers() {
}
}
columns = membersLt.getColumns();
- for (TableColumn column : columns) {
+ for (int i = 0; i < columns.length; i++) {
+ TableColumn column = columns[i];
column.pack();
}
membersLt.setHeaderVisible(true);
@@ -1065,7 +1076,8 @@ void updateParameters() {
item.setText(PARAM_FLAGS_COLUMN, getFlagsString(param.getFlags()));
}
TableColumn[] columns = paramsLt.getColumns();
- for (TableColumn column : columns) {
+ for (int i = 0; i < columns.length; i++) {
+ TableColumn column = columns[i];
column.pack();
}
paramsLt.setRedraw(true);
diff --git a/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/MetaDataGenerator.java b/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/MetaDataGenerator.java
index 284516f41c..44f58a34d1 100644
--- a/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/MetaDataGenerator.java
+++ b/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/MetaDataGenerator.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2018 IBM Corporation and others.
+ * Copyright (c) 2004, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -33,7 +33,8 @@ public void generate(JNIClass clazz) {
}
public void generate(JNIField[] fields) {
- for (JNIField field : fields) {
+ for (int i = 0; i < fields.length; i++) {
+ JNIField field = fields[i];
int mods = field.getModifiers();
if ((mods & Modifier.PUBLIC) == 0) continue;
if ((mods & Modifier.FINAL) != 0) continue;
@@ -53,7 +54,8 @@ public void generate(JNIField field) {
public void generate(JNIMethod[] methods) {
sort(methods);
- for (JNIMethod method : methods) {
+ for (int i = 0; i < methods.length; i++) {
+ JNIMethod method = methods[i];
if ((method.getModifiers() & Modifier.NATIVE) == 0) continue;
generate(method);
outputln();
diff --git a/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/NativesGenerator.java b/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/NativesGenerator.java
index c8583e58b5..f4ae947c36 100644
--- a/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/NativesGenerator.java
+++ b/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/NativesGenerator.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2018 IBM Corporation and others.
+ * Copyright (c) 2004, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -72,7 +72,8 @@ public void generate(JNIClass clazz) {
public void generate(JNIMethod[] methods) {
sort(methods);
- for (JNIMethod method : methods) {
+ for (int i = 0; i < methods.length; i++) {
+ JNIMethod method = methods[i];
if ((method.getModifiers() & Modifier.NATIVE) == 0) continue;
generate(method);
if (progress != null) progress.step();
@@ -222,7 +223,8 @@ public void setEnterExitMacro(boolean enterExitMacro) {
void generateExcludes(JNIMethod[] methods) {
HashSet<String> excludes = new HashSet<>();
- for (JNIMethod method : methods) {
+ for (int i = 0; i < methods.length; i++) {
+ JNIMethod method = methods[i];
if ((method.getModifiers() & Modifier.NATIVE) == 0) continue;
String exclude = method.getExclude();
if (exclude.length() != 0) {
@@ -231,7 +233,8 @@ void generateExcludes(JNIMethod[] methods) {
}
for (String exclude: excludes) {
outputln(exclude);
- for (JNIMethod method : methods) {
+ for (int i = 0; i < methods.length; i++) {
+ JNIMethod method = methods[i];
if ((method.getModifiers() & Modifier.NATIVE) == 0) continue;
String methodExclude = method.getExclude();
if (exclude.equals(methodExclude)) {
@@ -520,7 +523,8 @@ boolean generateLocalVars(JNIParameter[] params, JNIType returnType, JNIType ret
boolean generateGetters(JNIMethod method, JNIParameter[] params) {
boolean genFailTag = false;
int criticalCount = 0;
- for (JNIParameter param : params) {
+ for (int i = 0; i < params.length; i++) {
+ JNIParameter param = params[i];
if (!isCritical(param)) {
genFailTag |= generateGetParameter(method, param, false, 1);
} else {
@@ -528,7 +532,8 @@ boolean generateGetters(JNIMethod method, JNIParameter[] params) {
}
}
if (criticalCount != 0) {
- for (JNIParameter param : params) {
+ for (int i = 0; i < params.length; i++) {
+ JNIParameter param = params[i];
if (isCritical(param)) {
genFailTag |= generateGetParameter(method, param, true, 2);
}
diff --git a/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/ReflectField.java b/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/ReflectField.java
index da668963e0..6cc20a87f1 100644
--- a/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/ReflectField.java
+++ b/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/ReflectField.java
@@ -97,7 +97,7 @@ public String getAccessor() {
@Override
public String getCast() {
String cast = ((String)getParam("cast")).trim();
- if (!cast.isEmpty()) {
+ if (cast.length() > 0) {
if (!cast.startsWith("(")) cast = "(" + cast;
if (!cast.endsWith(")")) cast = cast + ")";
}
diff --git a/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/ReflectMethod.java b/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/ReflectMethod.java
index e8a68ed299..aef0caf4c9 100644
--- a/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/ReflectMethod.java
+++ b/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/ReflectMethod.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2018 IBM Corporation and others.
+ * Copyright (c) 2004, 2015 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -128,7 +128,8 @@ public boolean isNativeUnique() {
boolean result = true;
String name = getName();
JNIMethod[] methods = declaringClass.getDeclaredMethods();
- for (JNIMethod mth : methods) {
+ for (int i = 0; i < methods.length; i++) {
+ JNIMethod mth = methods[i];
if ((mth.getModifiers() & Modifier.NATIVE) != 0 &&
this != mth && !this.equals(mth) &&
name.equals(mth.getName()))
diff --git a/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/SizeofGenerator.java b/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/SizeofGenerator.java
index a56ea3f517..872a31c0c9 100644
--- a/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/SizeofGenerator.java
+++ b/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/SizeofGenerator.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2018 IBM Corporation and others.
+ * Copyright (c) 2004, 2013 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -10,7 +10,7 @@
*******************************************************************************/
package org.eclipse.swt.tools.internal;
-import java.lang.reflect.*;
+import java.lang.reflect.Modifier;
public class SizeofGenerator extends JNIGenerator {
@@ -36,7 +36,8 @@ public void generate() {
public void generate(JNIField[] fields) {
sort(fields);
- for (JNIField field : fields) {
+ for (int i = 0; i < fields.length; i++) {
+ JNIField field = fields[i];
if ((field.getModifiers() & Modifier.FINAL) == 0) continue;
generate(field);
}
@@ -57,7 +58,8 @@ public static void main(String[] args) {
}
try {
SizeofGenerator gen = new SizeofGenerator();
- for (String clazzName : args) {
+ for (int i = 0; i < args.length; i++) {
+ String clazzName = args[i];
Class<?> clazz = Class.forName(clazzName);
gen.generate(new ReflectClass(clazz));
}
diff --git a/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/StatsGenerator.java b/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/StatsGenerator.java
index 8ccab69987..f6d766bb49 100644
--- a/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/StatsGenerator.java
+++ b/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/StatsGenerator.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2018 IBM Corporation and others.
+ * Copyright (c) 2004, 2013 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -10,7 +10,7 @@
*******************************************************************************/
package org.eclipse.swt.tools.internal;
-import java.lang.reflect.*;
+import java.lang.reflect.Modifier;
public class StatsGenerator extends JNIGenerator {
@@ -110,7 +110,8 @@ void generateSourceFile(JNIClass clazz) {
output(className);
outputln("_nativeFunctionNames[] = {");
sort(methods);
- for (JNIMethod method : methods) {
+ for (int i = 0; i < methods.length; i++) {
+ JNIMethod method = methods[i];
if ((method.getModifiers() & Modifier.NATIVE) == 0) continue;
String function = getFunctionName(method), function64 = getFunctionName(method, method.getParameterTypes64());
if (!function.equals(function64)) {
@@ -192,7 +193,8 @@ void generateStatsNatives(String className) {
void generateFunctionEnum(JNIMethod[] methods) {
if (methods.length == 0) return;
outputln("typedef enum {");
- for (JNIMethod method : methods) {
+ for (int i = 0; i < methods.length; i++) {
+ JNIMethod method = methods[i];
if ((method.getModifiers() & Modifier.NATIVE) == 0) continue;
String function = getFunctionName(method), function64 = getFunctionName(method, method.getParameterTypes64());
if (!function.equals(function64)) {
diff --git a/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/StructsGenerator.java b/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/StructsGenerator.java
index f58d9c9e77..bc8d30c6cd 100644
--- a/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/StructsGenerator.java
+++ b/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/StructsGenerator.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2018 IBM Corporation and others.
+ * Copyright (c) 2004, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -80,7 +80,8 @@ public String getSuffix() {
void generateExcludes(JNIClass[] classes) {
HashSet<String> excludes = new HashSet<>();
- for (JNIClass clazz : classes) {
+ for (int i = 0; i < classes.length; i++) {
+ JNIClass clazz = classes[i];
String exclude = clazz.getExclude();
if (exclude.length() != 0) {
excludes.add(exclude);
@@ -88,7 +89,8 @@ void generateExcludes(JNIClass[] classes) {
}
for (String exclude : excludes) {
outputln(exclude);
- for (JNIClass clazz : classes) {
+ for (int i = 0; i < classes.length; i++) {
+ JNIClass clazz = classes[i];
String classExclude = clazz.getExclude();
if (exclude.equals(classExclude)) {
output("#define NO_");
@@ -199,7 +201,8 @@ void generateFIDsStructure(JNIClass clazz) {
output("\tjfieldID ");
JNIField[] fields = clazz.getDeclaredFields();
boolean first = true;
- for (JNIField field : fields) {
+ for (int i = 0; i < fields.length; i++) {
+ JNIField field = fields[i];
if (ignoreField(field)) continue;
if (!first) output(", ");
output(field.getName());
@@ -245,7 +248,8 @@ void generateCacheFunction(JNIClass clazz) {
}
outputln();
JNIField[] fields = clazz.getDeclaredFields();
- for (JNIField field : fields) {
+ for (int i = 0; i < fields.length; i++) {
+ JNIField field = fields[i];
if (ignoreField(field)) continue;
output("\t");
output(clazzName);
@@ -289,7 +293,8 @@ void generateGetFields(JNIClass clazz) {
}
}
JNIField[] fields = clazz.getDeclaredFields();
- for (JNIField field : fields) {
+ for (int i = 0; i < fields.length; i++) {
+ JNIField field = fields[i];
if (ignoreField(field)) continue;
String exclude = field.getExclude();
if (exclude.length() != 0) {
@@ -442,7 +447,8 @@ void generateSetFields(JNIClass clazz) {
}
}
JNIField[] fields = clazz.getDeclaredFields();
- for (JNIField field : fields) {
+ for (int i = 0; i < fields.length; i++) {
+ JNIField field = fields[i];
if (ignoreField(field)) continue;
String exclude = field.getExclude();
if (exclude.length() != 0) {
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 6d6a3e5620..f8dc4c1d09 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
@@ -450,7 +450,7 @@ public class JavadocBasher {
};
for (Entry<String, String> entry: comments.entrySet()) {
String name = entry.getKey();
- if (!entry.getValue().isEmpty()){
+ 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 58adc94850..2c9e7c2211 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2018 IBM Corporation and others.
+ * Copyright (c) 2008, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -50,7 +50,8 @@ static void list(File path, ArrayList<String> list) {
if (path == null) return;
File[] frameworks = path.listFiles();
if (frameworks == null) return;
- for (File file : frameworks) {
+ for (int i = 0; i < frameworks.length; i++) {
+ File file = frameworks[i];
String name = file.getName();
int index = name.lastIndexOf(".");
if (index != -1) {
@@ -673,7 +674,8 @@ void copyClassMethodsDown(final Map<String, Object[]> classes) {
ArrayList<Node> methods = (ArrayList<Node>)clazz[1];
Object[] superclass = classes.get(getSuperclassName(node));
if (superclass != null) {
- for (Node method : ((ArrayList<Node>) superclass[1])) {
+ for (Iterator<Node> iterator2 = ((ArrayList<Node>)superclass[1]).iterator(); iterator2.hasNext();) {
+ Node method = iterator2.next();
if (isStatic(method)) {
methods.add(method);
}
diff --git a/bundles/org.eclipse.swt.tools/Mac Generation/org/eclipse/swt/tools/internal/MacGeneratorUI.java b/bundles/org.eclipse.swt.tools/Mac Generation/org/eclipse/swt/tools/internal/MacGeneratorUI.java
index 862156248a..d5a31068e0 100644
--- a/bundles/org.eclipse.swt.tools/Mac Generation/org/eclipse/swt/tools/internal/MacGeneratorUI.java
+++ b/bundles/org.eclipse.swt.tools/Mac Generation/org/eclipse/swt/tools/internal/MacGeneratorUI.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2018 IBM Corporation and others.
+ * Copyright (c) 2008, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -41,9 +41,9 @@ public class MacGeneratorUI {
parentItem = lastParent;
} else {
TreeItem[] items = superItem.getItems();
- for (TreeItem item : items) {
- if (name.equals(item.getData())) {
- parentItem = item;
+ for (int i = 0; i < items.length; i++) {
+ if (name.equals(items[i].getData())) {
+ parentItem = items[i];
break;
}
}
@@ -122,15 +122,15 @@ public class MacGeneratorUI {
}
/* Figure out categories state */
TreeItem[] items = item.getItems();
- for (TreeItem item2 : items) {
- TreeItem[] children = item2.getItems();
+ for (int i = 0; i < items.length; i++) {
+ TreeItem[] children = items[i].getItems();
int checkedCount = 0;
for (int j = 0; j < children.length; j++) {
if (children[j].getChecked()) checkedCount++;
if (children[j].getGrayed()) break;
}
- item2.setChecked(checkedCount != 0);
- item2.setGrayed(checkedCount != children.length);
+ items[i].setChecked(checkedCount != 0);
+ items[i].setGrayed(checkedCount != children.length);
}
}
}
@@ -275,27 +275,30 @@ public class MacGeneratorUI {
// editorTx.addListener(SWT.FocusOut, textListener);
editorTx.addListener(SWT.KeyDown, textListener);
editorTx.addListener(SWT.Traverse, textListener);
- attribTable.addListener(SWT.MouseDown, e -> e.display.asyncExec (() -> {
- if (attribTable.isDisposed ()) return;
- if (e.button != 1) return;
- Point pt = new Point(e.x, e.y);
- TableItem item = attribTable.getItem(pt);
- if (item == null) return;
- int column = -1;
- for (int i = 0; i < attribTable.getColumnCount(); i++) {
- if (item.getBounds(i).contains(pt)) {
- column = i;
- break;
- }
+ attribTable.addListener(SWT.MouseDown, e -> e.display.asyncExec (new Runnable () {
+ @Override
+ public void run () {
+ if (attribTable.isDisposed ()) return;
+ if (e.button != 1) return;
+ Point pt = new Point(e.x, e.y);
+ TableItem item = attribTable.getItem(pt);
+ if (item == null) return;
+ int column = -1;
+ for (int i = 0; i < attribTable.getColumnCount(); i++) {
+ if (item.getBounds(i).contains(pt)) {
+ column = i;
+ break;
+ }
+ }
+ if (column == -1) return;
+ if (!getEditable(item, column)) return;
+ editor.setColumn(column);
+ editor.setItem(item);
+ editorTx.setText(item.getText(column));
+ editorTx.selectAll();
+ editorTx.setVisible(true);
+ editorTx.setFocus();
}
- if (column == -1) return;
- if (!getEditable(item, column)) return;
- editor.setColumn(column);
- editor.setItem(item);
- editorTx.setText(item.getText(column));
- editorTx.selectAll();
- editorTx.setVisible(true);
- editorTx.setFocus();
}));
return comp;
@@ -453,12 +456,13 @@ public class MacGeneratorUI {
}
TreeItem findItem(TreeItem[] items, Node node) {
- for (TreeItem item : items) {
+ for (int i = 0; i < items.length; i++) {
+ TreeItem item = items[i];
checkChildren(item);
if (item.getData() == node) return item;
}
- for (TreeItem item : items) {
- TreeItem child = findItem(item.getItems(), node);
+ for (int i = 0; i < items.length; i++) {
+ TreeItem child = findItem(items[i].getItems(), node);
if (child != null) return child;
}
return null;
diff --git a/bundles/org.eclipse.swt.tools/NativeStats/org/eclipse/swt/tools/internal/NativeStats.java b/bundles/org.eclipse.swt.tools/NativeStats/org/eclipse/swt/tools/internal/NativeStats.java
index 553f0ef3ef..dd45df8f95 100644
--- a/bundles/org.eclipse.swt.tools/NativeStats/org/eclipse/swt/tools/internal/NativeStats.java
+++ b/bundles/org.eclipse.swt.tools/NativeStats/org/eclipse/swt/tools/internal/NativeStats.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2018 IBM Corporation and others.
+ * Copyright (c) 2004, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -109,14 +109,16 @@ void dump(String className, NativeFunction[] funcs, PrintStream ps) {
if (funcs == null) return;
Arrays.sort(funcs);
int total = 0;
- for (NativeFunction func : funcs) {
+ for (int i = 0; i < funcs.length; i++) {
+ NativeFunction func = funcs[i];
total += func.getCallCount();
}
ps.print(className);
ps.print("=");
ps.print(total);
ps.println();
- for (NativeFunction func : funcs) {
+ for (int i = 0; i < funcs.length; i++) {
+ NativeFunction func = funcs[i];
if (func.getCallCount() > 0) {
ps.print("\t");
ps.print(func.getName());
@@ -133,7 +135,8 @@ public void reset() {
public Map<String, NativeFunction[]> snapshot() {
Map<String, NativeFunction[]> snapshot = new HashMap<>();
- for (String className : classes) {
+ for (int i = 0; i < classes.length; i++) {
+ String className = classes[i];
snapshot(className, snapshot);
}
return snapshot;

Back to the top