Skip to content
Commits on Source (5)
......@@ -2,9 +2,8 @@ Manifest-Version: 1.0
Bundle-Name: %pluginName
Bundle-Vendor: %providerName
Bundle-SymbolicName: org.eclipse.swt.tools.base;singleton:=true
Bundle-Version: 3.107.100.qualifier
Bundle-Version: 3.107.200.qualifier
Bundle-ManifestVersion: 2
Bundle-ActivationPolicy: lazy
Bundle-Localization: plugin
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Require-Bundle: org.eclipse.ui;bundle-version="3.4.0"
......@@ -14,11 +14,11 @@
<parent>
<artifactId>eclipse.platform.swt.localbuild</artifactId>
<groupId>eclipse.platform.swt</groupId>
<version>4.12.0-SNAPSHOT</version>
<version>4.13.0-SNAPSHOT</version>
<relativePath>../../local-build/local-build-parent/</relativePath>
</parent>
<groupId>org.eclipse.swt</groupId>
<artifactId>org.eclipse.swt.tools.base</artifactId>
<version>3.107.100-SNAPSHOT</version>
<version>3.107.200-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
......@@ -14,7 +14,7 @@
<parent>
<artifactId>eclipse.platform.swt.localbuild</artifactId>
<groupId>eclipse.platform.swt</groupId>
<version>4.12.0-SNAPSHOT</version>
<version>4.13.0-SNAPSHOT</version>
<relativePath>../../local-build/local-build-parent/</relativePath>
</parent>
<groupId>org.eclipse.swt</groupId>
......
eclipse.preferences.version=1
compilers.p.unresolved-ex-points=1
\ No newline at end of file
......@@ -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");
}
}
......
......@@ -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();
......
......@@ -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");
......
......@@ -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);
......
......@@ -371,6 +371,8 @@ JNIClass[] getASTClasses() {
if (cce.getMessage().startsWith(EnumDeclaration.class.getName())) {
// this can be ignored since enums don't affect native files
}
} catch (IndexOutOfBoundsException e) {
// ignore, can also happen because of enums
}
}
}
......
......@@ -763,7 +763,7 @@ void generateFunctionCall(JNIMethod method, JNIParameter[] params, JNIType retur
output(cast);
} else {
output("(");
output(name.substring(0, name.indexOf("_")));
output(name.substring(0, name.indexOf('_')));
output(" *)");
}
outputln("arg0;");
......
......@@ -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;
}
}
......
......@@ -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);
}
}
}
......
......@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-Name: %pluginName
Bundle-Vendor: %providerName
Bundle-SymbolicName: org.eclipse.swt.tools; singleton:=true
Bundle-Version: 3.107.400.qualifier
Bundle-Version: 3.108.0.qualifier
Bundle-Activator: org.eclipse.swt.tools.Activator
Bundle-ManifestVersion: 2
Export-Package: org.eclipse.swt.tools,
......
......@@ -319,7 +319,7 @@ void generateMethods(String className, ArrayList<Node> methods) {
out(" ");
String methodName = sel;
if (isUnique(method, methods)) {
int index = methodName.indexOf(":");
int index = methodName.indexOf(':');
if (index != -1) methodName = methodName.substring(0, index);
} else {
//TODO improve this selector
......@@ -1246,7 +1246,7 @@ boolean isUnique(Node method, ArrayList<Node> methods) {
signature += getJavaType(param);
}
}
int index = methodName.indexOf(":");
int index = methodName.indexOf(':');
if (index != -1) methodName = methodName.substring(0, index);
for (Node other : methods) {
NamedNodeMap attributes = other.getAttributes();
......@@ -1254,7 +1254,7 @@ boolean isUnique(Node method, ArrayList<Node> methods) {
if (attributes != null) otherSel = attributes.getNamedItem("selector");
if (other != method && otherSel != null) {
String otherName = otherSel.getNodeValue();
index = otherName.indexOf(":");
index = otherName.indexOf(':');
if (index != -1) otherName = otherName.substring(0, index);
if (methodName.equals(otherName)) {
NodeList otherParams = other.getChildNodes();
......
......@@ -29,36 +29,4 @@
</builder>
</extension>
<extension
point="org.eclipse.jdt.core.compilationParticipant">
<compilationParticipant
class="org.eclipse.swt.tools.builders.Check64CompilationParticipant"
id="org.eclipse.swt.tools.Check64CompilationParticipant">
</compilationParticipant>
</extension>
<extension
point="org.eclipse.ui.popupMenus">
<objectContribution
objectClass="org.eclipse.jdt.core.IJavaProject"
id="org.eclipse.swt.tools.contribution">
<menu
label="%pluginName"
path="additions"
id="org.eclipse.swt.tools.menu">
<separator
name="group1">
</separator>
</menu>
<action
label="%enableCheck64Name"
class="org.eclipse.swt.tools.builders.Check64EnableAction"
menubarPath="org.eclipse.swt.tools.menu/group1"
style="toggle"
enablesFor="1"
id="org.eclipse.swt.tools.check64EnableAction">
</action>
</objectContribution>
</extension>
</plugin>
......@@ -14,11 +14,11 @@
<parent>
<artifactId>eclipse.platform.swt.localbuild</artifactId>
<groupId>eclipse.platform.swt</groupId>
<version>4.12.0-SNAPSHOT</version>
<version>4.13.0-SNAPSHOT</version>
<relativePath>../../local-build/local-build-parent/</relativePath>
</parent>
<groupId>org.eclipse.swt</groupId>
<artifactId>org.eclipse.swt.tools</artifactId>
<version>3.107.400-SNAPSHOT</version>
<version>3.108.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>