Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Vogel2019-07-05 03:27:02 -0400
committerLars Vogel2019-07-05 04:58:52 -0400
commitf2344b3db3239bb775f2c0afda9585a3225e17d1 (patch)
treec530896f115e225242f6fcfad41b2eb64937a1fa
parentfc9b884466b4cea64613988d1bbd2425e18472ae (diff)
downloadeclipse.platform.swt-f2344b3db3239bb775f2c0afda9585a3225e17d1.tar.gz
eclipse.platform.swt-f2344b3db3239bb775f2c0afda9585a3225e17d1.tar.xz
eclipse.platform.swt-f2344b3db3239bb775f2c0afda9585a3225e17d1.zip
Using indexOf char instead of indexOf String
See https://sourceforge.net/p/findbugs/feature-requests/300/#cb7f for a performance related discussion Change-Id: I255d2fa2b525281d9a6724aadbf85828236dbb30 Signed-off-by: Lars Vogel <Lars.Vogel@vogella.com>
-rw-r--r--bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/NativesGenerator.java2
-rw-r--r--bundles/org.eclipse.swt.tools/Mac Generation/org/eclipse/swt/tools/internal/MacGenerator.java6
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Program/gtk/org/eclipse/swt/program/Program.java2
-rw-r--r--examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet80.java2
4 files changed, 6 insertions, 6 deletions
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 de2904560d..0af18e99f6 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
@@ -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;");
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 9a20291627..22cb881b86 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
@@ -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();
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Program/gtk/org/eclipse/swt/program/Program.java b/bundles/org.eclipse.swt/Eclipse SWT Program/gtk/org/eclipse/swt/program/Program.java
index 05e9ba0c87..e2003d15a3 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Program/gtk/org/eclipse/swt/program/Program.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Program/gtk/org/eclipse/swt/program/Program.java
@@ -218,7 +218,7 @@ public ImageData getImageData() {
List<String> mimeTypes = new ArrayList<>();
String mimeType = line.substring(0, separatorIndex);
String extensionFormat = line.substring(separatorIndex + 1);
- int extensionIndex = extensionFormat.indexOf(".");
+ int extensionIndex = extensionFormat.indexOf('.');
if (extensionIndex > 0) {
String extension = extensionFormat.substring(extensionIndex);
if (mimeTable.containsKey(extension)) {
diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet80.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet80.java
index 59f527789c..6f14f3ecba 100644
--- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet80.java
+++ b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet80.java
@@ -54,7 +54,7 @@ public static void main(String[] args) {
TreeItem[] revisedSelection = new TreeItem[0];
for (int i = 0; i < selection.length; i++) {
String text = selection[i].getText();
- if (text.indexOf("1") > 0) {
+ if (text.indexOf('1') > 0) {
TreeItem[] newSelection = new TreeItem[revisedSelection.length + 1];
System.arraycopy(revisedSelection, 0, newSelection, 0, revisedSelection.length);
newSelection[revisedSelection.length] = selection[i];

Back to the top