Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/ASTField.java16
-rw-r--r--bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/ASTMethod.java32
-rw-r--r--bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/CleanupConstants.java2
-rw-r--r--bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/CleanupNatives.java2
-rw-r--r--bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/ReflectField.java16
-rw-r--r--bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/ReflectMethod.java32
6 files changed, 50 insertions, 50 deletions
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 0696cefe95..91bcb310fa 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
@@ -47,14 +47,14 @@ public ASTField(ASTClass declaringClass, String source, FieldDeclaration field,
type64 = this.type;
if (GEN64) {
String s = source.substring(field.getStartPosition(), field.getStartPosition() + field.getLength());
- if (type.isType("int") && s.indexOf("int /*long*/") != -1) type64 = new ASTType("J");
- else if (type.isType("float") && s.indexOf("float /*double*/") != -1) type64 = new ASTType("D");
- else if (type.isType("[I") && (s.indexOf("int /*long*/") != -1 || s.indexOf("int[] /*long[]*/") != -1)) type64 = new ASTType("[J");
- else if (type.isType("[F") && (s.indexOf("float /*double*/") != -1|| s.indexOf("float[] /*double[]*/") != -1)) type64 = new ASTType("[D");
- else if (type.isType("long") && s.indexOf("long /*int*/") != -1) type = new ASTType("I");
- else if (type.isType("double") && s.indexOf("double /*float*/") != -1) type = new ASTType("F");
- else if (type.isType("[J") && (s.indexOf("long /*int*/") != -1|| s.indexOf("long[] /*int[]*/") != -1)) type = new ASTType("[I");
- else if (type.isType("[D") && (s.indexOf("double /*float*/") != -1|| s.indexOf("double[] /*float[]*/") != -1)) type = new ASTType("[F");
+ if (type.isType("int") && s.contains("int /*long*/")) type64 = new ASTType("J");
+ else if (type.isType("float") && s.contains("float /*double*/")) type64 = new ASTType("D");
+ else if (type.isType("[I") && (s.contains("int /*long*/") || s.contains("int[] /*long[]*/"))) type64 = new ASTType("[J");
+ else if (type.isType("[F") && (s.contains("float /*double*/")|| s.contains("float[] /*double[]*/"))) type64 = new ASTType("[D");
+ else if (type.isType("long") && s.contains("long /*int*/")) type = new ASTType("I");
+ else if (type.isType("double") && s.contains("double /*float*/")) type = new ASTType("F");
+ else if (type.isType("[J") && (s.contains("long /*int*/")|| s.contains("long[] /*int[]*/"))) type = new ASTType("[I");
+ else if (type.isType("[D") && (s.contains("double /*float*/")|| s.contains("double[] /*float[]*/"))) type = new ASTType("[F");
}
}
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 c3613d746f..28953f2def 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
@@ -52,14 +52,14 @@ public ASTMethod(ASTClass declaringClass, String source, MethodDeclaration metho
returnType64 = returnType;
if (GEN64) {
String s = source.substring(method.getReturnType2().getStartPosition(), method.getName().getStartPosition());
- if (returnType.isType("int") && s.indexOf("int /*long*/") != -1) returnType64 = new ASTType("J");
- else if (returnType.isType("float") && s.indexOf("float /*double*/") != -1) returnType64 = new ASTType("D");
- else if (returnType.isType("[I") && (s.indexOf("int /*long*/") != -1 || s.indexOf("int[] /*long[]*/") != -1)) returnType64 = new ASTType("[J");
- else if (returnType.isType("[F") && (s.indexOf("float /*double*/") != -1|| s.indexOf("float[] /*double[]*/") != -1)) returnType64 = new ASTType("[D");
- else if (returnType.isType("long") && s.indexOf("long /*int*/") != -1) returnType = new ASTType("I");
- else if (returnType.isType("double") && s.indexOf("double /*float*/") != -1) returnType = new ASTType("F");
- else if (returnType.isType("[J") && (s.indexOf("long /*int*/") != -1|| s.indexOf("long[] /*int[]*/") != -1)) returnType = new ASTType("[I");
- else if (returnType.isType("[D") && (s.indexOf("double /*float*/") != -1|| s.indexOf("double[] /*float[]*/") != -1)) returnType = new ASTType("[F");
+ if (returnType.isType("int") && s.contains("int /*long*/")) returnType64 = new ASTType("J");
+ else if (returnType.isType("float") && s.contains("float /*double*/")) returnType64 = new ASTType("D");
+ else if (returnType.isType("[I") && (s.contains("int /*long*/") || s.contains("int[] /*long[]*/"))) returnType64 = new ASTType("[J");
+ else if (returnType.isType("[F") && (s.contains("float /*double*/")|| s.contains("float[] /*double[]*/"))) returnType64 = new ASTType("[D");
+ else if (returnType.isType("long") && s.contains("long /*int*/")) returnType = new ASTType("I");
+ else if (returnType.isType("double") && s.contains("double /*float*/")) returnType = new ASTType("F");
+ else if (returnType.isType("[J") && (s.contains("long /*int*/")|| s.contains("long[] /*int[]*/"))) returnType = new ASTType("[I");
+ else if (returnType.isType("[D") && (s.contains("double /*float*/")|| s.contains("double[] /*float[]*/"))) returnType = new ASTType("[F");
}
List<SingleVariableDeclaration> parameters = method.parameters();
@@ -74,14 +74,14 @@ public ASTMethod(ASTClass declaringClass, String source, MethodDeclaration metho
this.parameters[i] = new ASTParameter(this, i, param.getName().getIdentifier());
if (GEN64) {
String s = source.substring(param.getStartPosition(), param.getStartPosition() + param.getLength());
- if (paramTypes[i].isType("int") && s.indexOf("int /*long*/") != -1) paramTypes64[i] = new ASTType("J");
- else if (paramTypes[i].isType("float") && s.indexOf("float /*double*/") != -1) paramTypes64[i] = new ASTType("D");
- else if (paramTypes[i].isType("[I") && (s.indexOf("int /*long*/") != -1 || s.indexOf("int[] /*long[]*/") != -1)) paramTypes64[i] = new ASTType("[J");
- else if (paramTypes[i].isType("[F") && (s.indexOf("float /*double*/") != -1|| s.indexOf("float[] /*double[]*/") != -1)) paramTypes64[i] = new ASTType("[D");
- else if (paramTypes[i].isType("long") && s.indexOf("long /*int*/") != -1) paramTypes[i] = new ASTType("I");
- else if (paramTypes[i].isType("double") && s.indexOf("double /*float*/") != -1) paramTypes[i] = new ASTType("F");
- else if (paramTypes[i].isType("[J") && (s.indexOf("long /*int*/") != -1|| s.indexOf("long[] /*int[]*/") != -1)) paramTypes[i] = new ASTType("[I");
- else if (paramTypes[i].isType("[D") && (s.indexOf("double /*float*/") != -1|| s.indexOf("double[] /*float[]*/") != -1)) paramTypes[i] = new ASTType("[F");
+ if (paramTypes[i].isType("int") && s.contains("int /*long*/")) paramTypes64[i] = new ASTType("J");
+ else if (paramTypes[i].isType("float") && s.contains("float /*double*/")) paramTypes64[i] = new ASTType("D");
+ else if (paramTypes[i].isType("[I") && (s.contains("int /*long*/") || s.contains("int[] /*long[]*/"))) paramTypes64[i] = new ASTType("[J");
+ else if (paramTypes[i].isType("[F") && (s.contains("float /*double*/")|| s.contains("float[] /*double[]*/"))) paramTypes64[i] = new ASTType("[D");
+ else if (paramTypes[i].isType("long") && s.contains("long /*int*/")) paramTypes[i] = new ASTType("I");
+ else if (paramTypes[i].isType("double") && s.contains("double /*float*/")) paramTypes[i] = new ASTType("F");
+ else if (paramTypes[i].isType("[J") && (s.contains("long /*int*/")|| s.contains("long[] /*int[]*/"))) paramTypes[i] = new ASTType("[I");
+ else if (paramTypes[i].isType("[D") && (s.contains("double /*float*/")|| s.contains("double[] /*float[]*/"))) paramTypes[i] = new ASTType("[F");
}
if (tags != null) {
String name = param.getName().getIdentifier();
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 d065dbd5e5..5b8c1af1a2 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
@@ -53,7 +53,7 @@ public void generate(JNIField[] fields) {
public void generate(JNIField field) {
String name = field.getName();
for (String str : files.values()) {
- if (str.indexOf(name) != -1) {
+ if (str.contains(name)) {
int modifiers = field.getModifiers();
String modifiersStr = Modifier.toString(modifiers);
output("\t");
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 fd2186fa53..c2f6c3529c 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
@@ -42,7 +42,7 @@ public void generate(JNIMethod[] methods) {
public void generate(JNIMethod method) {
String name = method.getName();
for (String str : files.values()) {
- if (str.indexOf(name) != -1) {
+ if (str.contains(name)) {
// int modifiers = method.getModifiers();
// Class clazz = method.getDeclaringClass();
// String modifiersStr = Modifier.toString(modifiers);
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 c2c48e4b49..37937b0185 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
@@ -41,14 +41,14 @@ public ReflectField(ReflectClass declaringClass, Field field, String source, Com
VariableDeclarationFragment decl = (VariableDeclarationFragment) iterator.next();
if (decl.getName().getIdentifier().equals(field.getName())) {
String s = source.substring(node.getStartPosition(), node.getStartPosition() + node.getLength());
- if (clazz == int.class && s.indexOf("int /*long*/") != -1) type64 = new ReflectType(long.class);
- else if (clazz == float.class && s.indexOf("float /*double*/") != -1) type64 = new ReflectType(double.class);
- else if (clazz == int[].class && (s.indexOf("int /*long*/") != -1 || s.indexOf("int[] /*long[]*/") != -1)) type64 = new ReflectType(long[].class);
- else if (clazz == float[].class && (s.indexOf("float /*double*/") != -1|| s.indexOf("float[] /*double[]*/") != -1)) type = new ReflectType(double[].class);
- else if (clazz == long.class && s.indexOf("long /*int*/") != -1) type = new ReflectType(int.class);
- else if (clazz == double.class && s.indexOf("double /*float*/") != -1) type = new ReflectType(float.class);
- else if (clazz == long[].class && (s.indexOf("long /*int*/") != -1|| s.indexOf("long[] /*int[]*/") != -1)) type = new ReflectType(int[].class);
- else if (clazz == double[].class && (s.indexOf("double /*float*/") != -1|| s.indexOf("double[] /*float[]*/") != -1)) type = new ReflectType(float[].class);
+ if (clazz == int.class && s.contains("int /*long*/")) type64 = new ReflectType(long.class);
+ else if (clazz == float.class && s.contains("float /*double*/")) type64 = new ReflectType(double.class);
+ else if (clazz == int[].class && (s.contains("int /*long*/") || s.contains("int[] /*long[]*/"))) type64 = new ReflectType(long[].class);
+ else if (clazz == float[].class && (s.contains("float /*double*/")|| s.contains("float[] /*double[]*/"))) type = new ReflectType(double[].class);
+ else if (clazz == long.class && s.contains("long /*int*/")) type = new ReflectType(int.class);
+ else if (clazz == double.class && s.contains("double /*float*/")) type = new ReflectType(float.class);
+ else if (clazz == long[].class && (s.contains("long /*int*/")|| s.contains("long[] /*int[]*/"))) type = new ReflectType(int[].class);
+ else if (clazz == double[].class && (s.contains("double /*float*/")|| s.contains("double[] /*float[]*/"))) type = new ReflectType(float[].class);
break;
}
}
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 08f9ccd6c7..107103cff8 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
@@ -73,28 +73,28 @@ public ReflectMethod(ReflectClass declaringClass, Method method, String source,
Class<?> clazz = paramTypes[i];
SingleVariableDeclaration node = (SingleVariableDeclaration)decl.parameters().get(i);
String s = source.substring(node.getStartPosition(), node.getStartPosition() + node.getLength());
- if (clazz == int.class && s.indexOf("int /*long*/") != -1) this.paramTypes64[i] = new ReflectType(long.class);
- else if (clazz == int[].class && (s.indexOf("int /*long*/") != -1 || s.indexOf("int[] /*long[]*/") != -1)) this.paramTypes64[i] = new ReflectType(long[].class);
- else if (clazz == float.class && s.indexOf("float /*double*/") != -1) this.paramTypes64[i] = new ReflectType(double.class);
- else if (clazz == float[].class && (s.indexOf("float /*double*/") != -1|| s.indexOf("float[] /*double[]*/") != -1)) this.paramTypes64[i] = new ReflectType(double[].class);
- else if (clazz == long.class && s.indexOf("long /*int*/") != -1) this.paramTypes[i] = new ReflectType(int.class);
- else if (clazz == long[].class && (s.indexOf("long /*int*/") != -1|| s.indexOf("long[] /*int[]*/") != -1)) this.paramTypes[i] = new ReflectType(int[].class);
- else if (clazz == double.class && s.indexOf("double /*float*/") != -1) this.paramTypes[i] = new ReflectType(float.class);
- else if (clazz == double[].class && (s.indexOf("double /*float*/") != -1|| s.indexOf("double[] /*float[]*/") != -1)) this.paramTypes[i] = new ReflectType(float[].class);
+ if (clazz == int.class && s.contains("int /*long*/")) this.paramTypes64[i] = new ReflectType(long.class);
+ else if (clazz == int[].class && (s.contains("int /*long*/") || s.contains("int[] /*long[]*/"))) this.paramTypes64[i] = new ReflectType(long[].class);
+ else if (clazz == float.class && s.contains("float /*double*/")) this.paramTypes64[i] = new ReflectType(double.class);
+ else if (clazz == float[].class && (s.contains("float /*double*/")|| s.contains("float[] /*double[]*/"))) this.paramTypes64[i] = new ReflectType(double[].class);
+ else if (clazz == long.class && s.contains("long /*int*/")) this.paramTypes[i] = new ReflectType(int.class);
+ else if (clazz == long[].class && (s.contains("long /*int*/")|| s.contains("long[] /*int[]*/"))) this.paramTypes[i] = new ReflectType(int[].class);
+ else if (clazz == double.class && s.contains("double /*float*/")) this.paramTypes[i] = new ReflectType(float.class);
+ else if (clazz == double[].class && (s.contains("double /*float*/")|| s.contains("double[] /*float[]*/"))) this.paramTypes[i] = new ReflectType(float[].class);
}
}
if (canChange64(returnType)) {
Class<?> clazz = returnType;
ASTNode node = decl.getReturnType2();
String s = source.substring(node.getStartPosition(), decl.getName().getStartPosition());
- if (clazz == int.class && s.indexOf("int /*long*/") != -1) this.returnType64 = new ReflectType(long.class);
- else if (clazz == int[].class && (s.indexOf("int /*long*/") != -1 || s.indexOf("int[] /*long[]*/") != -1)) this.returnType64 = new ReflectType(long[].class);
- else if (clazz == float.class && s.indexOf("float /*double*/") != -1) this.returnType64 = new ReflectType(double.class);
- else if (clazz == float[].class && (s.indexOf("float /*double*/") != -1|| s.indexOf("float[] /*double[]*/") != -1)) this.returnType64 = new ReflectType(double[].class);
- else if (clazz == long.class && s.indexOf("long /*int*/") != -1) this.returnType = new ReflectType(int.class);
- else if (clazz == long[].class && (s.indexOf("long /*int*/") != -1|| s.indexOf("long[] /*int[]*/") != -1)) this.returnType = new ReflectType(int[].class);
- else if (clazz == double.class && s.indexOf("double /*float*/") != -1) this.returnType = new ReflectType(float.class);
- else if (clazz == double[].class && (s.indexOf("double /*float*/") != -1|| s.indexOf("double[] /*float[]*/") != -1)) this.returnType = new ReflectType(float[].class);
+ if (clazz == int.class && s.contains("int /*long*/")) this.returnType64 = new ReflectType(long.class);
+ else if (clazz == int[].class && (s.contains("int /*long*/") || s.contains("int[] /*long[]*/"))) this.returnType64 = new ReflectType(long[].class);
+ else if (clazz == float.class && s.contains("float /*double*/")) this.returnType64 = new ReflectType(double.class);
+ else if (clazz == float[].class && (s.contains("float /*double*/")|| s.contains("float[] /*double[]*/"))) this.returnType64 = new ReflectType(double[].class);
+ else if (clazz == long.class && s.contains("long /*int*/")) this.returnType = new ReflectType(int.class);
+ else if (clazz == long[].class && (s.contains("long /*int*/")|| s.contains("long[] /*int[]*/"))) this.returnType = new ReflectType(int[].class);
+ else if (clazz == double.class && s.contains("double /*float*/")) this.returnType = new ReflectType(float.class);
+ else if (clazz == double[].class && (s.contains("double /*float*/")|| s.contains("double[] /*float[]*/"))) this.returnType = new ReflectType(float[].class);
}
}
}

Back to the top