Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kurtakov2018-04-27 10:18:26 +0000
committerAlexander Kurtakov2018-04-27 10:20:34 +0000
commit9a92da14a27e579409c00ff3eefd197eac4209da (patch)
tree04e77e62326f7d3f4e651b00efbb88f98114dca3
parentd31a640dc02a4f04fd0b8c1b1d3ee6ea59377acf (diff)
downloadeclipse.platform.swt-9a92da14a27e579409c00ff3eefd197eac4209da.tar.gz
eclipse.platform.swt-9a92da14a27e579409c00ff3eefd197eac4209da.tar.xz
eclipse.platform.swt-9a92da14a27e579409c00ff3eefd197eac4209da.zip
For each conversion in swt.tools.
Change-Id: I9b24de33ba07df5717bb32326392f24555d5c88d Signed-off-by: Alexander Kurtakov <akurtako@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, 116 insertions, 177 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 a642b92ed9..e54221e232 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 (int i = 0; i < imports.length; i++) {
- file = new File(basePath + imports[i].replace('.', '/') + "/" + simpleName + ".java");
+ for (String import1 : imports) {
+ file = new File(basePath + import1.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 (int i = 0; i < imports.length; i++) {
- file = new File(basePath + imports[i].replace('.', '/') + "/" + simpleName + ".java");
+ for (String import1 : imports) {
+ file = new File(basePath + import1.replace('.', '/') + "/" + simpleName + ".java");
if (file.exists()) {
- return imports[i] + "." + simpleName;
+ return import1 + "." + simpleName;
}
}
return simpleName;
@@ -99,8 +99,7 @@ public ASTClass(String sourcePath, MetaData metaData) {
FieldDeclaration[] fields = type.getFields();
List<ASTField> fid = new ArrayList<>();
- for (int i = 0; i < fields.length; i++) {
- FieldDeclaration field = fields[i];
+ for (FieldDeclaration field : fields) {
List<VariableDeclarationFragment> fragments = field.fragments();
for (VariableDeclarationFragment fragment : fragments) {
fid.add(new ASTField(this, source, field, fragment));
@@ -109,9 +108,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 (int i = 0; i < methods.length; i++) {
- if (methods[i].getReturnType2() == null) continue;
- mid.add(new ASTMethod(this, source, methods[i]));
+ for (MethodDeclaration method : methods) {
+ if (method.getReturnType2() == null) continue;
+ mid.add(new ASTMethod(this, source, method));
}
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 1f490d200c..4427e75731 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.length() > 0) {
+ if (!cast.isEmpty()) {
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 a8cd8ce367..c251dc5745 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,8 +64,7 @@ public ASTMethod(ASTClass declaringClass, String source, MethodDeclaration metho
paramTypes64 = new ASTType[parameters.size()];
this.parameters = new ASTParameter[paramTypes.length];
int i = 0;
- for (Iterator<SingleVariableDeclaration> iterator = parameters.iterator(); iterator.hasNext(); i++) {
- SingleVariableDeclaration param = iterator.next();
+ for (SingleVariableDeclaration param : parameters) {
paramTypes[i] = new ASTType(declaringClass.resolver, param.getType(), param.getExtraDimensions());
paramTypes64[i] = paramTypes[i];
this.parameters[i] = new ASTParameter(this, i, param.getName().getIdentifier());
@@ -116,8 +115,7 @@ public boolean isNativeUnique() {
boolean result = true;
String name = getName();
JNIMethod[] methods = declaringClass.getDeclaredMethods();
- for (int i = 0; i < methods.length; i++) {
- JNIMethod mth = methods[i];
+ for (JNIMethod mth : methods) {
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 181d347b4d..bf40e0064d 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,8 +31,7 @@ public String flatten() {
Set<String> set = params.keySet();
String[] keys = set.toArray(new String[set.size()]);
Arrays.sort(keys);
- for (int j = 0; j < keys.length; j++) {
- String key = keys[j];
+ for (String key : keys) {
Object value = params.get(key);
String valueStr = "";
if (value instanceof String) {
@@ -77,8 +76,8 @@ public String[] getFlags() {
@Override
public boolean getFlag(String flag) {
String[] flags = getFlags();
- for (int i = 0; i < flags.length; i++) {
- if (flags[i].equals(flag)) return true;
+ for (String flag2 : flags) {
+ if (flag2.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 8f4cc1c977..fa768cdcf1 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,8 +99,7 @@ void loadDirectory(File file) {
if (entries == null) {
entries = new String[0];
}
- for (int i = 0; i < entries.length; i++) {
- String entry = entries[i];
+ for (String entry : entries) {
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 69b58d0608..d0192c7b14 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, 2017 IBM Corporation and others.
+ * Copyright (c) 2004, 2018 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,8 +40,7 @@ public void generate(JNIClass clazz) {
public void generate(JNIField[] fields) {
sort(fields);
- for (int i = 0; i < fields.length; i++) {
- JNIField field = fields[i];
+ for (JNIField field : fields) {
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 db66465645..293f759c9f 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, 2017 IBM Corporation and others.
+ * Copyright (c) 2004, 2018 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,8 +29,7 @@ public void generate(JNIClass clazz) {
public void generate(JNIMethod[] methods) {
sort(methods);
- for (int i = 0; i < methods.length; i++) {
- JNIMethod method = methods[i];
+ for (JNIMethod method : methods) {
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 8bce4db357..385371f676 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, 2013 IBM Corporation and others.
+ * Copyright (c) 2004, 2018 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.Modifier;
+import java.lang.reflect.*;
public class ConstantsGenerator extends JNIGenerator {
@@ -23,8 +23,7 @@ public void generate(JNIClass clazz) {
public void generate(JNIField[] fields) {
sort(fields);
outputln("int main() {");
- for (int i = 0; i < fields.length; i++) {
- JNIField field = fields[i];
+ for (JNIField field : fields) {
if ((field.getModifiers() & Modifier.FINAL) == 0) continue;
generate(field);
}
@@ -52,8 +51,7 @@ public static void main(String[] args) {
}
try {
ConstantsGenerator gen = new ConstantsGenerator();
- for (int i = 0; i < args.length; i++) {
- String clazzName = args[i];
+ for (String clazzName : args) {
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 1c457c13ef..23694e775c 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,8 +49,7 @@ public void generate(JNIClass clazz) {
}
public void generate(JNIField[] fields) {
- for (int i = 0; i < fields.length; i++) {
- JNIField field = fields[i];
+ for (JNIField field : fields) {
int mods = field.getModifiers();
if ((mods & Modifier.PUBLIC) == 0) continue;
if ((mods & Modifier.FINAL) != 0) continue;
@@ -70,8 +69,7 @@ public void generate(JNIField field) {
}
public void generate(JNIMethod[] methods) {
- for (int i = 0; i < methods.length; i++) {
- JNIMethod method = methods[i];
+ for (JNIMethod method : methods) {
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 110167a12d..83557aabbe 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,8 +131,7 @@ static String getFunctionName(JNIMethod method, JNIType[] paramTypes) {
StringBuilder buffer = new StringBuilder();
buffer.append(function);
buffer.append("__");
- for (int i = 0; i < paramTypes.length; i++) {
- JNIType paramType = paramTypes[i];
+ for (JNIType paramType : paramTypes) {
buffer.append(toC(paramType.getTypeSignature(false)));
}
return buffer.toString();
@@ -217,8 +216,7 @@ public void generate() {
generateAutoGenNote();
generateIncludes();
sort(classes);
- for (int i = 0; i < classes.length; i++) {
- JNIClass clazz = classes[i];
+ for (JNIClass clazz : classes) {
if (getGenerate(clazz)) generate(clazz);
if (progress != null) progress.step();
}
@@ -238,8 +236,7 @@ public JNIClass[] getClasses() {
}
public boolean getCPP() {
- for (int i = 0; i < classes.length; i++) {
- JNIClass clazz = classes[i];
+ for (JNIClass clazz : classes) {
if (clazz.getFlag(FLAG_CPP)) {
return true;
}
@@ -272,8 +269,7 @@ public String getOutputName() {
}
public boolean getM() {
- for (int i = 0; i < classes.length; i++) {
- JNIClass clazz = classes[i];
+ for (JNIClass clazz : classes) {
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 8a9ed8723d..6125715888 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, 2017 IBM Corporation and others.
+ * Copyright (c) 2004, 2018 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,11 +226,9 @@ public void generate(ProgressMonitor progress) {
this.progress = progress;
if (progress != null) {
int nativeCount = 0;
- for (int i = 0; i < natives.length; i++) {
- JNIClass clazz = natives[i];
+ for (JNIClass clazz : natives) {
JNIMethod[] methods = clazz.getDeclaredMethods();
- for (int j = 0; j < methods.length; j++) {
- JNIMethod method = methods[j];
+ for (JNIMethod method : methods) {
if ((method.getModifiers() & Modifier.NATIVE) == 0) continue;
nativeCount++;
}
@@ -299,8 +297,7 @@ String[] getClassNames() {
if(entries == null) {
entries = new String[0];
}
- for (int i = 0; i < entries.length; i++) {
- String entry = entries[i];
+ for (String entry : entries) {
File f = new File(file, entry);
if (!f.isDirectory()) {
if (f.getAbsolutePath().endsWith(".class")) {
@@ -354,8 +351,7 @@ JNIClass[] getASTClasses() {
if (files == null) {
files = new File[0];
}
- for (int i = 0; i < files.length; i++) {
- File file = files[i];
+ for (File file : files) {
try {
String path = file.getAbsolutePath().replace('\\', '/');
if (path.endsWith(".java")) {
@@ -381,11 +377,9 @@ JNIClass[] getASTClasses() {
public JNIClass[] getNativesClasses(JNIClass[] classes) {
if (mainClass == null) return new JNIClass[0];
List<JNIClass> result = new ArrayList<>();
- for (int i = 0; i < classes.length; i++) {
- JNIClass clazz = classes[i];
+ for (JNIClass clazz : classes) {
JNIMethod[] methods = clazz.getDeclaredMethods();
- for (int j = 0; j < methods.length; j++) {
- JNIMethod method = methods[j];
+ for (JNIMethod method : methods) {
int mods = method.getModifiers();
if ((mods & Modifier.NATIVE) != 0) {
result.add(clazz);
@@ -410,8 +404,7 @@ public JNIClass[] getStructureClasses(JNIClass[] classes) {
}
JNIField[] fields = clazz.getDeclaredFields();
boolean hasPublicFields = false;
- for (int j = 0; j < fields.length; j++) {
- JNIField field = fields[j];
+ for (JNIField field : fields) {
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 7a0834b38b..21274bd229 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,8 +152,7 @@ void generateAll() {
shell.setCursor(cursor);
shell.setEnabled(false);
Control[] children = actionsPanel.getChildren();
- for (int i = 0; i < children.length; i++) {
- Control child = children[i];
+ for (Control child : children) {
if (child instanceof Button) child.setEnabled(false);
}
boolean showProgress = true;
@@ -201,8 +200,7 @@ void generateAll() {
while (!done[0]) {
if (!display.readAndDispatch()) display.sleep();
}
- for (int i = 0; i < children.length; i++) {
- Control child = children[i];
+ for (Control child : children) {
if (child instanceof Button) child.setEnabled(true);
}
if (showProgress) {
@@ -240,8 +238,7 @@ JNIMethod[] getSelectedMethods() {
TableItem[] selection = membersLt.getSelection();
JNIMethod[] methods = new JNIMethod[selection.length];
int count = 0;
- for (int i = 0; i < selection.length; i++) {
- TableItem item = selection [i];
+ for (TableItem item : selection) {
Object data = item.getData();
if (data instanceof JNIMethod) {
methods[count++] = (JNIMethod)data;
@@ -259,8 +256,7 @@ JNIField[] getSelectedFields() {
TableItem[] selection = membersLt.getSelection();
JNIField[] fields = new JNIField[selection.length];
int count = 0;
- for (int i = 0; i < selection.length; i++) {
- TableItem item = selection [i];
+ for (TableItem item : selection) {
Object data = item.getData();
if (data instanceof JNIField) {
fields[count++] = (JNIField)data;
@@ -915,8 +911,7 @@ String getClassString(JNIType type) {
String getFlagsString(String[] flags) {
if (flags.length == 0) return "";
StringBuilder buffer = new StringBuilder();
- for (int j = 0; j < flags.length; j++) {
- String flag = flags[j];
+ for (String flag : flags) {
if (buffer.length() != 0) buffer.append(", ");
buffer.append(flag);
}
@@ -958,8 +953,7 @@ void updateClasses() {
item.setChecked(clazz.getGenerate());
}
TableColumn[] columns = classesLt.getColumns();
- for (int i = 0; i < columns.length; i++) {
- TableColumn column = columns[i];
+ for (TableColumn column : columns) {
column.pack();
}
classesLt.setSelection(mainIndex);
@@ -969,8 +963,7 @@ void updateMembers() {
membersLt.removeAll();
membersLt.setHeaderVisible(false);
TableColumn[] columns = membersLt.getColumns();
- for (int i = 0; i < columns.length; i++) {
- TableColumn column = columns[i];
+ for (TableColumn column : columns) {
column.dispose();
}
int[] indices = classesLt.getSelectionIndices();
@@ -979,8 +972,7 @@ void updateMembers() {
JNIClass clazz = (JNIClass)classItem.getData();
boolean hasNatives = false;
JNIMethod[] methods = clazz.getDeclaredMethods();
- for (int i = 0; i < methods.length; i++) {
- JNIMethod method = methods[i];
+ for (JNIMethod method : methods) {
int mods = method.getModifiers();
if (hasNatives =((mods & Modifier.NATIVE) != 0)) break;
}
@@ -998,8 +990,7 @@ void updateMembers() {
column.setText("Exclude");
*/
JNIGenerator.sort(methods);
- for (int i = 0; i < methods.length; i++) {
- JNIMethod method = methods[i];
+ for (JNIMethod method : methods) {
if ((method.getModifiers() & Modifier.NATIVE) == 0) continue;
TableItem item = new TableItem(membersLt, SWT.NONE);
item.setData(method);
@@ -1026,8 +1017,7 @@ void updateMembers() {
column.setText("Exclude");
*/
JNIField[] fields = clazz.getDeclaredFields();
- for (int i = 0; i < fields.length; i++) {
- JNIField field = fields[i];
+ for (JNIField field : fields) {
int mods = field.getModifiers();
if (((mods & Modifier.PUBLIC) == 0) ||
((mods & Modifier.FINAL) != 0) ||
@@ -1045,8 +1035,7 @@ void updateMembers() {
}
}
columns = membersLt.getColumns();
- for (int i = 0; i < columns.length; i++) {
- TableColumn column = columns[i];
+ for (TableColumn column : columns) {
column.pack();
}
membersLt.setHeaderVisible(true);
@@ -1076,8 +1065,7 @@ void updateParameters() {
item.setText(PARAM_FLAGS_COLUMN, getFlagsString(param.getFlags()));
}
TableColumn[] columns = paramsLt.getColumns();
- for (int i = 0; i < columns.length; i++) {
- TableColumn column = columns[i];
+ for (TableColumn column : columns) {
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 44f58a34d1..284516f41c 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, 2017 IBM Corporation and others.
+ * Copyright (c) 2004, 2018 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,8 +33,7 @@ public void generate(JNIClass clazz) {
}
public void generate(JNIField[] fields) {
- for (int i = 0; i < fields.length; i++) {
- JNIField field = fields[i];
+ for (JNIField field : fields) {
int mods = field.getModifiers();
if ((mods & Modifier.PUBLIC) == 0) continue;
if ((mods & Modifier.FINAL) != 0) continue;
@@ -54,8 +53,7 @@ public void generate(JNIField field) {
public void generate(JNIMethod[] methods) {
sort(methods);
- for (int i = 0; i < methods.length; i++) {
- JNIMethod method = methods[i];
+ for (JNIMethod method : methods) {
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 f4ae947c36..c8583e58b5 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, 2017 IBM Corporation and others.
+ * Copyright (c) 2004, 2018 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,8 +72,7 @@ public void generate(JNIClass clazz) {
public void generate(JNIMethod[] methods) {
sort(methods);
- for (int i = 0; i < methods.length; i++) {
- JNIMethod method = methods[i];
+ for (JNIMethod method : methods) {
if ((method.getModifiers() & Modifier.NATIVE) == 0) continue;
generate(method);
if (progress != null) progress.step();
@@ -223,8 +222,7 @@ public void setEnterExitMacro(boolean enterExitMacro) {
void generateExcludes(JNIMethod[] methods) {
HashSet<String> excludes = new HashSet<>();
- for (int i = 0; i < methods.length; i++) {
- JNIMethod method = methods[i];
+ for (JNIMethod method : methods) {
if ((method.getModifiers() & Modifier.NATIVE) == 0) continue;
String exclude = method.getExclude();
if (exclude.length() != 0) {
@@ -233,8 +231,7 @@ void generateExcludes(JNIMethod[] methods) {
}
for (String exclude: excludes) {
outputln(exclude);
- for (int i = 0; i < methods.length; i++) {
- JNIMethod method = methods[i];
+ for (JNIMethod method : methods) {
if ((method.getModifiers() & Modifier.NATIVE) == 0) continue;
String methodExclude = method.getExclude();
if (exclude.equals(methodExclude)) {
@@ -523,8 +520,7 @@ boolean generateLocalVars(JNIParameter[] params, JNIType returnType, JNIType ret
boolean generateGetters(JNIMethod method, JNIParameter[] params) {
boolean genFailTag = false;
int criticalCount = 0;
- for (int i = 0; i < params.length; i++) {
- JNIParameter param = params[i];
+ for (JNIParameter param : params) {
if (!isCritical(param)) {
genFailTag |= generateGetParameter(method, param, false, 1);
} else {
@@ -532,8 +528,7 @@ boolean generateGetters(JNIMethod method, JNIParameter[] params) {
}
}
if (criticalCount != 0) {
- for (int i = 0; i < params.length; i++) {
- JNIParameter param = params[i];
+ for (JNIParameter param : params) {
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 6cc20a87f1..da668963e0 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.length() > 0) {
+ if (!cast.isEmpty()) {
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 aef0caf4c9..e8a68ed299 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, 2015 IBM Corporation and others.
+ * Copyright (c) 2004, 2018 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,8 +128,7 @@ public boolean isNativeUnique() {
boolean result = true;
String name = getName();
JNIMethod[] methods = declaringClass.getDeclaredMethods();
- for (int i = 0; i < methods.length; i++) {
- JNIMethod mth = methods[i];
+ for (JNIMethod mth : methods) {
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 872a31c0c9..a56ea3f517 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, 2013 IBM Corporation and others.
+ * Copyright (c) 2004, 2018 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.Modifier;
+import java.lang.reflect.*;
public class SizeofGenerator extends JNIGenerator {
@@ -36,8 +36,7 @@ public void generate() {
public void generate(JNIField[] fields) {
sort(fields);
- for (int i = 0; i < fields.length; i++) {
- JNIField field = fields[i];
+ for (JNIField field : fields) {
if ((field.getModifiers() & Modifier.FINAL) == 0) continue;
generate(field);
}
@@ -58,8 +57,7 @@ public static void main(String[] args) {
}
try {
SizeofGenerator gen = new SizeofGenerator();
- for (int i = 0; i < args.length; i++) {
- String clazzName = args[i];
+ for (String clazzName : args) {
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 f6d766bb49..8ccab69987 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, 2013 IBM Corporation and others.
+ * Copyright (c) 2004, 2018 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.Modifier;
+import java.lang.reflect.*;
public class StatsGenerator extends JNIGenerator {
@@ -110,8 +110,7 @@ void generateSourceFile(JNIClass clazz) {
output(className);
outputln("_nativeFunctionNames[] = {");
sort(methods);
- for (int i = 0; i < methods.length; i++) {
- JNIMethod method = methods[i];
+ for (JNIMethod method : methods) {
if ((method.getModifiers() & Modifier.NATIVE) == 0) continue;
String function = getFunctionName(method), function64 = getFunctionName(method, method.getParameterTypes64());
if (!function.equals(function64)) {
@@ -193,8 +192,7 @@ void generateStatsNatives(String className) {
void generateFunctionEnum(JNIMethod[] methods) {
if (methods.length == 0) return;
outputln("typedef enum {");
- for (int i = 0; i < methods.length; i++) {
- JNIMethod method = methods[i];
+ for (JNIMethod method : methods) {
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 bc8d30c6cd..f58d9c9e77 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, 2017 IBM Corporation and others.
+ * Copyright (c) 2004, 2018 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,8 +80,7 @@ public String getSuffix() {
void generateExcludes(JNIClass[] classes) {
HashSet<String> excludes = new HashSet<>();
- for (int i = 0; i < classes.length; i++) {
- JNIClass clazz = classes[i];
+ for (JNIClass clazz : classes) {
String exclude = clazz.getExclude();
if (exclude.length() != 0) {
excludes.add(exclude);
@@ -89,8 +88,7 @@ void generateExcludes(JNIClass[] classes) {
}
for (String exclude : excludes) {
outputln(exclude);
- for (int i = 0; i < classes.length; i++) {
- JNIClass clazz = classes[i];
+ for (JNIClass clazz : classes) {
String classExclude = clazz.getExclude();
if (exclude.equals(classExclude)) {
output("#define NO_");
@@ -201,8 +199,7 @@ void generateFIDsStructure(JNIClass clazz) {
output("\tjfieldID ");
JNIField[] fields = clazz.getDeclaredFields();
boolean first = true;
- for (int i = 0; i < fields.length; i++) {
- JNIField field = fields[i];
+ for (JNIField field : fields) {
if (ignoreField(field)) continue;
if (!first) output(", ");
output(field.getName());
@@ -248,8 +245,7 @@ void generateCacheFunction(JNIClass clazz) {
}
outputln();
JNIField[] fields = clazz.getDeclaredFields();
- for (int i = 0; i < fields.length; i++) {
- JNIField field = fields[i];
+ for (JNIField field : fields) {
if (ignoreField(field)) continue;
output("\t");
output(clazzName);
@@ -293,8 +289,7 @@ void generateGetFields(JNIClass clazz) {
}
}
JNIField[] fields = clazz.getDeclaredFields();
- for (int i = 0; i < fields.length; i++) {
- JNIField field = fields[i];
+ for (JNIField field : fields) {
if (ignoreField(field)) continue;
String exclude = field.getExclude();
if (exclude.length() != 0) {
@@ -447,8 +442,7 @@ void generateSetFields(JNIClass clazz) {
}
}
JNIField[] fields = clazz.getDeclaredFields();
- for (int i = 0; i < fields.length; i++) {
- JNIField field = fields[i];
+ for (JNIField field : fields) {
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 f8dc4c1d09..6d6a3e5620 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().length() > 0){
+ if (!entry.getValue().isEmpty()){
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 2c9e7c2211..58adc94850 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, 2017 IBM Corporation and others.
+ * Copyright (c) 2008, 2018 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,8 +50,7 @@ static void list(File path, ArrayList<String> list) {
if (path == null) return;
File[] frameworks = path.listFiles();
if (frameworks == null) return;
- for (int i = 0; i < frameworks.length; i++) {
- File file = frameworks[i];
+ for (File file : frameworks) {
String name = file.getName();
int index = name.lastIndexOf(".");
if (index != -1) {
@@ -674,8 +673,7 @@ void copyClassMethodsDown(final Map<String, Object[]> classes) {
ArrayList<Node> methods = (ArrayList<Node>)clazz[1];
Object[] superclass = classes.get(getSuperclassName(node));
if (superclass != null) {
- for (Iterator<Node> iterator2 = ((ArrayList<Node>)superclass[1]).iterator(); iterator2.hasNext();) {
- Node method = iterator2.next();
+ for (Node method : ((ArrayList<Node>) superclass[1])) {
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 d5a31068e0..862156248a 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, 2016 IBM Corporation and others.
+ * Copyright (c) 2008, 2018 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 (int i = 0; i < items.length; i++) {
- if (name.equals(items[i].getData())) {
- parentItem = items[i];
+ for (TreeItem item : items) {
+ if (name.equals(item.getData())) {
+ parentItem = item;
break;
}
}
@@ -122,15 +122,15 @@ public class MacGeneratorUI {
}
/* Figure out categories state */
TreeItem[] items = item.getItems();
- for (int i = 0; i < items.length; i++) {
- TreeItem[] children = items[i].getItems();
+ for (TreeItem item2 : items) {
+ TreeItem[] children = item2.getItems();
int checkedCount = 0;
for (int j = 0; j < children.length; j++) {
if (children[j].getChecked()) checkedCount++;
if (children[j].getGrayed()) break;
}
- items[i].setChecked(checkedCount != 0);
- items[i].setGrayed(checkedCount != children.length);
+ item2.setChecked(checkedCount != 0);
+ item2.setGrayed(checkedCount != children.length);
}
}
}
@@ -275,30 +275,27 @@ 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 (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();
+ 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;
+ }
}
+ 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;
@@ -456,13 +453,12 @@ public class MacGeneratorUI {
}
TreeItem findItem(TreeItem[] items, Node node) {
- for (int i = 0; i < items.length; i++) {
- TreeItem item = items[i];
+ for (TreeItem item : items) {
checkChildren(item);
if (item.getData() == node) return item;
}
- for (int i = 0; i < items.length; i++) {
- TreeItem child = findItem(items[i].getItems(), node);
+ for (TreeItem item : items) {
+ TreeItem child = findItem(item.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 dd45df8f95..553f0ef3ef 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, 2016 IBM Corporation and others.
+ * Copyright (c) 2004, 2018 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,16 +109,14 @@ void dump(String className, NativeFunction[] funcs, PrintStream ps) {
if (funcs == null) return;
Arrays.sort(funcs);
int total = 0;
- for (int i = 0; i < funcs.length; i++) {
- NativeFunction func = funcs[i];
+ for (NativeFunction func : funcs) {
total += func.getCallCount();
}
ps.print(className);
ps.print("=");
ps.print(total);
ps.println();
- for (int i = 0; i < funcs.length; i++) {
- NativeFunction func = funcs[i];
+ for (NativeFunction func : funcs) {
if (func.getCallCount() > 0) {
ps.print("\t");
ps.print(func.getName());
@@ -135,8 +133,7 @@ public void reset() {
public Map<String, NativeFunction[]> snapshot() {
Map<String, NativeFunction[]> snapshot = new HashMap<>();
- for (int i = 0; i < classes.length; i++) {
- String className = classes[i];
+ for (String className : classes) {
snapshot(className, snapshot);
}
return snapshot;

Back to the top