Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Vogel2019-06-19 11:23:58 -0400
committerLars Vogel2019-06-21 04:52:41 -0400
commit0ee11246ee44dc773a8a91a6fb1b18864a781708 (patch)
treece4fb33e0a37b45b86a7dbb9d33c1b8b7ad4a280
parentb1ecd006bfe55fc077015cc7ddece8825e013d9f (diff)
downloadrt.equinox.bundles-Y20190627-0200.tar.gz
rt.equinox.bundles-Y20190627-0200.tar.xz
rt.equinox.bundles-Y20190627-0200.zip
Useless toString call in String concatination Using String.valueOf instead of ""+ Use faster indexof('') version Change-Id: I991e0fe67138c3e7e35090ac9c23be687e75b417 Signed-off-by: Lars Vogel <Lars.Vogel@vogella.com>
-rw-r--r--bundles/org.eclipse.equinox.common/src/org/eclipse/core/internal/boot/PlatformURLConnection.java6
-rw-r--r--bundles/org.eclipse.equinox.common/src/org/eclipse/core/internal/boot/PlatformURLHandler.java2
-rw-r--r--bundles/org.eclipse.equinox.common/src/org/eclipse/core/internal/runtime/PlatformURLFragmentConnection.java2
-rw-r--r--bundles/org.eclipse.equinox.common/src/org/eclipse/core/internal/runtime/PlatformURLMetaConnection.java2
-rw-r--r--bundles/org.eclipse.equinox.common/src/org/eclipse/core/internal/runtime/PlatformURLPluginConnection.java2
-rw-r--r--bundles/org.eclipse.equinox.common/src/org/eclipse/core/internal/runtime/ReferenceHashSet.java6
-rw-r--r--bundles/org.eclipse.equinox.common/src/org/eclipse/core/runtime/Path.java2
-rw-r--r--bundles/org.eclipse.equinox.concurrent/src/org/eclipse/equinox/concurrent/future/ThreadsExecutor.java2
-rwxr-xr-xbundles/org.eclipse.equinox.console/src/org/eclipse/equinox/console/command/adapter/Activator.java2
-rwxr-xr-xbundles/org.eclipse.equinox.console/src/org/eclipse/equinox/console/command/adapter/CustomCommandInterpreter.java2
-rwxr-xr-xbundles/org.eclipse.equinox.console/src/org/eclipse/equinox/console/commands/CommandsTracker.java8
-rwxr-xr-xbundles/org.eclipse.equinox.console/src/org/eclipse/equinox/console/commands/EquinoxCommandProvider.java2
-rwxr-xr-xbundles/org.eclipse.equinox.console/src/org/eclipse/equinox/console/commands/EquinoxCommandsConverter.java4
-rwxr-xr-xbundles/org.eclipse.equinox.console/src/org/eclipse/equinox/console/commands/Util.java4
-rwxr-xr-xbundles/org.eclipse.equinox.console/src/org/eclipse/equinox/console/completion/CommandNamesCompleter.java2
-rwxr-xr-xbundles/org.eclipse.equinox.console/src/org/eclipse/equinox/console/telnet/TelnetCommand.java2
-rw-r--r--bundles/org.eclipse.equinox.util/src/org/eclipse/equinox/internal/util/impl/tpt/timer/TimerImpl.java2
-rw-r--r--bundles/org.eclipse.equinox.util/src/org/eclipse/equinox/internal/util/ref/Log.java4
18 files changed, 28 insertions, 28 deletions
diff --git a/bundles/org.eclipse.equinox.common/src/org/eclipse/core/internal/boot/PlatformURLConnection.java b/bundles/org.eclipse.equinox.common/src/org/eclipse/core/internal/boot/PlatformURLConnection.java
index 3beee578..acf5231f 100644
--- a/bundles/org.eclipse.equinox.common/src/org/eclipse/core/internal/boot/PlatformURLConnection.java
+++ b/bundles/org.eclipse.equinox.common/src/org/eclipse/core/internal/boot/PlatformURLConnection.java
@@ -218,7 +218,7 @@ public abstract class PlatformURLConnection extends URLConnection {
}
protected void debug(String s) {
- System.out.println("URL " + getURL().toString() + "^" + Integer.toHexString(Thread.currentThread().hashCode()) + " " + s); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ System.out.println("URL " + getURL() + "^" + Integer.toHexString(Thread.currentThread().hashCode()) + " " + s); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
private static void debugStartup(String s) {
@@ -299,9 +299,9 @@ public abstract class PlatformURLConnection extends URLConnection {
isInCache = true;
} else {
// attempt to cache
- int ix = file.lastIndexOf("/"); //$NON-NLS-1$
+ int ix = file.lastIndexOf('/'); //$NON-NLS-1$
tmp = file.substring(ix + 1);
- tmp = cacheLocation + filePrefix + Long.toString((new java.util.Date()).getTime()) + "_" + tmp; //$NON-NLS-1$
+ tmp = cacheLocation + filePrefix + (new java.util.Date()).getTime() + "_" + tmp; //$NON-NLS-1$
tmp = tmp.replace(File.separatorChar, '/');
if (isJar) {
tmp = PlatformURLHandler.FILE + PlatformURLHandler.PROTOCOL_SEPARATOR + tmp + PlatformURLHandler.JAR_SEPARATOR + jarEntry;
diff --git a/bundles/org.eclipse.equinox.common/src/org/eclipse/core/internal/boot/PlatformURLHandler.java b/bundles/org.eclipse.equinox.common/src/org/eclipse/core/internal/boot/PlatformURLHandler.java
index 122b1f1c..16da49af 100644
--- a/bundles/org.eclipse.equinox.common/src/org/eclipse/core/internal/boot/PlatformURLHandler.java
+++ b/bundles/org.eclipse.equinox.common/src/org/eclipse/core/internal/boot/PlatformURLHandler.java
@@ -51,7 +51,7 @@ public class PlatformURLHandler extends AbstractURLStreamHandlerService {
String spec = url.getFile().trim();
if (spec.startsWith("/")) //$NON-NLS-1$
spec = spec.substring(1);
- int ix = spec.indexOf("/"); //$NON-NLS-1$
+ int ix = spec.indexOf('/'); //$NON-NLS-1$
if (ix == -1)
throw new MalformedURLException(NLS.bind(CommonMessages.url_invalidURL, url.toExternalForm()));
diff --git a/bundles/org.eclipse.equinox.common/src/org/eclipse/core/internal/runtime/PlatformURLFragmentConnection.java b/bundles/org.eclipse.equinox.common/src/org/eclipse/core/internal/runtime/PlatformURLFragmentConnection.java
index 5d7732d2..f06d296c 100644
--- a/bundles/org.eclipse.equinox.common/src/org/eclipse/core/internal/runtime/PlatformURLFragmentConnection.java
+++ b/bundles/org.eclipse.equinox.common/src/org/eclipse/core/internal/runtime/PlatformURLFragmentConnection.java
@@ -49,7 +49,7 @@ public class PlatformURLFragmentConnection extends PlatformURLConnection {
spec = spec.substring(1);
if (!spec.startsWith(FRAGMENT))
throw new IOException(NLS.bind(CommonMessages.url_badVariant, url));
- int ix = spec.indexOf("/", FRAGMENT.length() + 1); //$NON-NLS-1$
+ int ix = spec.indexOf('/', FRAGMENT.length() + 1); //$NON-NLS-1$
String ref = ix == -1 ? spec.substring(FRAGMENT.length() + 1) : spec.substring(FRAGMENT.length() + 1, ix);
String id = getId(ref);
Activator activator = Activator.getDefault();
diff --git a/bundles/org.eclipse.equinox.common/src/org/eclipse/core/internal/runtime/PlatformURLMetaConnection.java b/bundles/org.eclipse.equinox.common/src/org/eclipse/core/internal/runtime/PlatformURLMetaConnection.java
index f8c94814..b86d5588 100644
--- a/bundles/org.eclipse.equinox.common/src/org/eclipse/core/internal/runtime/PlatformURLMetaConnection.java
+++ b/bundles/org.eclipse.equinox.common/src/org/eclipse/core/internal/runtime/PlatformURLMetaConnection.java
@@ -40,7 +40,7 @@ public class PlatformURLMetaConnection extends PlatformURLConnection {
spec = spec.substring(1);
if (!spec.startsWith(META))
throw new IOException(NLS.bind(CommonMessages.url_badVariant, url.toString()));
- int ix = spec.indexOf("/", META.length() + 1); //$NON-NLS-1$
+ int ix = spec.indexOf('/', META.length() + 1); //$NON-NLS-1$
String ref = ix == -1 ? spec.substring(META.length() + 1) : spec.substring(META.length() + 1, ix);
String id = getId(ref);
Activator activator = Activator.getDefault();
diff --git a/bundles/org.eclipse.equinox.common/src/org/eclipse/core/internal/runtime/PlatformURLPluginConnection.java b/bundles/org.eclipse.equinox.common/src/org/eclipse/core/internal/runtime/PlatformURLPluginConnection.java
index 47f1a3f8..c371d120 100644
--- a/bundles/org.eclipse.equinox.common/src/org/eclipse/core/internal/runtime/PlatformURLPluginConnection.java
+++ b/bundles/org.eclipse.equinox.common/src/org/eclipse/core/internal/runtime/PlatformURLPluginConnection.java
@@ -53,7 +53,7 @@ public class PlatformURLPluginConnection extends PlatformURLConnection {
spec = spec.substring(1);
if (!spec.startsWith(PLUGIN))
throw new IOException(NLS.bind(CommonMessages.url_badVariant, originalURL));
- int ix = spec.indexOf("/", PLUGIN.length() + 1); //$NON-NLS-1$
+ int ix = spec.indexOf('/', PLUGIN.length() + 1); //$NON-NLS-1$
String ref = ix == -1 ? spec.substring(PLUGIN.length() + 1) : spec.substring(PLUGIN.length() + 1, ix);
String id = getId(ref);
Activator activator = Activator.getDefault();
diff --git a/bundles/org.eclipse.equinox.common/src/org/eclipse/core/internal/runtime/ReferenceHashSet.java b/bundles/org.eclipse.equinox.common/src/org/eclipse/core/internal/runtime/ReferenceHashSet.java
index 1f4cdb1f..d997ee1b 100644
--- a/bundles/org.eclipse.equinox.common/src/org/eclipse/core/internal/runtime/ReferenceHashSet.java
+++ b/bundles/org.eclipse.equinox.common/src/org/eclipse/core/internal/runtime/ReferenceHashSet.java
@@ -60,7 +60,7 @@ public class ReferenceHashSet<T> {
Object referent = super.get();
if (referent == null)
return "[hashCode=" + this.hashCode + "] <referent was garbage collected>"; //$NON-NLS-1$ //$NON-NLS-2$
- return "[hashCode=" + this.hashCode + "] " + referent.toString(); //$NON-NLS-1$ //$NON-NLS-2$
+ return "[hashCode=" + this.hashCode + "] " + referent; //$NON-NLS-1$ //$NON-NLS-2$
}
}
@@ -94,7 +94,7 @@ public class ReferenceHashSet<T> {
Object referent = super.get();
if (referent == null)
return "[hashCode=" + this.hashCode + "] <referent was garbage collected>"; //$NON-NLS-1$ //$NON-NLS-2$
- return "[hashCode=" + this.hashCode + "] " + referent.toString(); //$NON-NLS-1$ //$NON-NLS-2$
+ return "[hashCode=" + this.hashCode + "] " + referent; //$NON-NLS-1$ //$NON-NLS-2$
}
}
@@ -312,7 +312,7 @@ public class ReferenceHashSet<T> {
if (value != null) {
Object ref = value.get();
if (ref != null) {
- buffer.append(ref.toString());
+ buffer.append(ref);
buffer.append(", "); //$NON-NLS-1$
}
}
diff --git a/bundles/org.eclipse.equinox.common/src/org/eclipse/core/runtime/Path.java b/bundles/org.eclipse.equinox.common/src/org/eclipse/core/runtime/Path.java
index 0818f6f9..5ff5fe7b 100644
--- a/bundles/org.eclipse.equinox.common/src/org/eclipse/core/runtime/Path.java
+++ b/bundles/org.eclipse.equinox.common/src/org/eclipse/core/runtime/Path.java
@@ -319,7 +319,7 @@ public class Path implements IPath, Cloneable {
@Override
public IPath append(String tail) {
//optimize addition of a single segment
- if (tail.indexOf(SEPARATOR) == -1 && !tail.contains("\\") && tail.indexOf(DEVICE_SEPARATOR) == -1) { //$NON-NLS-1$
+ if (tail.indexOf(SEPARATOR) == -1 && tail.indexOf('\\') == -1 && tail.indexOf(DEVICE_SEPARATOR) == -1) { //$NON-NLS-1$
int tailLength = tail.length();
if (tailLength < 3) {
//some special cases
diff --git a/bundles/org.eclipse.equinox.concurrent/src/org/eclipse/equinox/concurrent/future/ThreadsExecutor.java b/bundles/org.eclipse.equinox.concurrent/src/org/eclipse/equinox/concurrent/future/ThreadsExecutor.java
index 5ecd8c35..89302754 100644
--- a/bundles/org.eclipse.equinox.concurrent/src/org/eclipse/equinox/concurrent/future/ThreadsExecutor.java
+++ b/bundles/org.eclipse.equinox.concurrent/src/org/eclipse/equinox/concurrent/future/ThreadsExecutor.java
@@ -39,7 +39,7 @@ public class ThreadsExecutor extends AbstractExecutor {
}
protected String createThreadName(IProgressRunnable<?> runnable) {
- return "ThreadsExecutor(" + runnable.toString() + ")"; //$NON-NLS-1$ //$NON-NLS-2$
+ return "ThreadsExecutor(" + runnable + ")"; //$NON-NLS-1$ //$NON-NLS-2$
}
/**
diff --git a/bundles/org.eclipse.equinox.console/src/org/eclipse/equinox/console/command/adapter/Activator.java b/bundles/org.eclipse.equinox.console/src/org/eclipse/equinox/console/command/adapter/Activator.java
index e58e9863..b0e32532 100755
--- a/bundles/org.eclipse.equinox.console/src/org/eclipse/equinox/console/command/adapter/Activator.java
+++ b/bundles/org.eclipse.equinox.console/src/org/eclipse/equinox/console/command/adapter/Activator.java
@@ -311,7 +311,7 @@ public class Activator implements BundleActivator {
dict.put("osgi.command.scope", "equinox");
String[] methodNames = new String[commandMethods.length];
for (int i = 0; i < commandMethods.length; i++) {
- String methodName = "" + commandMethods[i].getName().substring(1);
+ String methodName = commandMethods[i].getName().substring(1);
methodNames[i] = methodName;
}
diff --git a/bundles/org.eclipse.equinox.console/src/org/eclipse/equinox/console/command/adapter/CustomCommandInterpreter.java b/bundles/org.eclipse.equinox.console/src/org/eclipse/equinox/console/command/adapter/CustomCommandInterpreter.java
index b21f88fd..09a429b2 100755
--- a/bundles/org.eclipse.equinox.console/src/org/eclipse/equinox/console/command/adapter/CustomCommandInterpreter.java
+++ b/bundles/org.eclipse.equinox.console/src/org/eclipse/equinox/console/command/adapter/CustomCommandInterpreter.java
@@ -214,7 +214,7 @@ public void printBundleResource(Bundle bundle, String resource) {
System.err.println(e);
}
} else {
- println("CONSOLE_RESOURCE ["+resource+"] NOT_IN_BUNDLE " + bundle.toString());
+ println("CONSOLE_RESOURCE ["+resource+"] NOT_IN_BUNDLE " + bundle);
}
}
diff --git a/bundles/org.eclipse.equinox.console/src/org/eclipse/equinox/console/commands/CommandsTracker.java b/bundles/org.eclipse.equinox.console/src/org/eclipse/equinox/console/commands/CommandsTracker.java
index f4c1e2a5..89cddec5 100755
--- a/bundles/org.eclipse.equinox.console/src/org/eclipse/equinox/console/commands/CommandsTracker.java
+++ b/bundles/org.eclipse.equinox.console/src/org/eclipse/equinox/console/commands/CommandsTracker.java
@@ -57,10 +57,10 @@ public class CommandsTracker {
synchronized (lock) {
if (function.getClass().isArray()) {
for (Object func : ((Object[]) function)) {
- commandNames.add(scope.toString() + ":" + func.toString());
+ commandNames.add(scope + ":" + func);
}
} else {
- commandNames.add(scope.toString() + ":" + function.toString());
+ commandNames.add(scope + ":" + function);
}
return commandNames;
}
@@ -80,10 +80,10 @@ public class CommandsTracker {
if (scope != null && function != null) {
if (!function.getClass().isArray()) {
- commandNames.remove(scope.toString() + ":" + function.toString());
+ commandNames.remove(scope + ":" + function);
} else {
for (Object func : (Object[]) function) {
- commandNames.remove(scope.toString() + ":" + func.toString());
+ commandNames.remove(scope + ":" + func);
}
}
}
diff --git a/bundles/org.eclipse.equinox.console/src/org/eclipse/equinox/console/commands/EquinoxCommandProvider.java b/bundles/org.eclipse.equinox.console/src/org/eclipse/equinox/console/commands/EquinoxCommandProvider.java
index fbb1ef01..b07c67a6 100755
--- a/bundles/org.eclipse.equinox.console/src/org/eclipse/equinox/console/commands/EquinoxCommandProvider.java
+++ b/bundles/org.eclipse.equinox.console/src/org/eclipse/equinox/console/commands/EquinoxCommandProvider.java
@@ -1247,7 +1247,7 @@ public class EquinoxCommandProvider implements SynchronousBundleListener {
if (envInfo != null) {
System.out.println(ConsoleMsg.CONSOLE_SETTING_PROPERTIES_TITLE);
for(String argument : arguments) {
- int index = argument.indexOf("=");
+ int index = argument.indexOf('=');
if(index > -1) {
String key = argument.substring(0, index);
String value = argument.substring(index + 1, argument.length());
diff --git a/bundles/org.eclipse.equinox.console/src/org/eclipse/equinox/console/commands/EquinoxCommandsConverter.java b/bundles/org.eclipse.equinox.console/src/org/eclipse/equinox/console/commands/EquinoxCommandsConverter.java
index d4c64e66..cee89de6 100755
--- a/bundles/org.eclipse.equinox.console/src/org/eclipse/equinox/console/commands/EquinoxCommandsConverter.java
+++ b/bundles/org.eclipse.equinox.console/src/org/eclipse/equinox/console/commands/EquinoxCommandsConverter.java
@@ -78,7 +78,7 @@ public class EquinoxCommandsConverter implements Converter {
// check for @ -- this may separate either the version string, or be part of the
// location
- int ix = symbolicName.indexOf("@"); //$NON-NLS-1$
+ int ix = symbolicName.indexOf('@'); //$NON-NLS-1$
if (ix != -1) {
if ((ix + 1) != symbolicName.length()) {
try {
@@ -174,7 +174,7 @@ public class EquinoxCommandsConverter implements Converter {
StringBuilder builder = new StringBuilder();
for (i = 0; i < count; i++) {
- builder.append(" " + keys[i] + " = " + dic.get(keys[i])); //$NON-NLS-1$//$NON-NLS-2$
+ builder.append(" ").append(keys[i]).append(" = ").append(dic.get(keys[i])); //$NON-NLS-1$//$NON-NLS-2$
builder.append("\r\n");
}
builder.append("\r\n");
diff --git a/bundles/org.eclipse.equinox.console/src/org/eclipse/equinox/console/commands/Util.java b/bundles/org.eclipse.equinox.console/src/org/eclipse/equinox/console/commands/Util.java
index 46197dc6..32b39497 100755
--- a/bundles/org.eclipse.equinox.console/src/org/eclipse/equinox/console/commands/Util.java
+++ b/bundles/org.eclipse.equinox.console/src/org/eclipse/equinox/console/commands/Util.java
@@ -202,10 +202,10 @@ public class Util {
StringBuilder stringBuffer = new StringBuilder(length);
if (onLeft)
- stringBuffer.append(padding.toString());
+ stringBuffer.append(padding);
stringBuffer.append(input);
if (!onLeft)
- stringBuffer.append(padding.toString());
+ stringBuffer.append(padding);
return stringBuffer.toString();
}
}
diff --git a/bundles/org.eclipse.equinox.console/src/org/eclipse/equinox/console/completion/CommandNamesCompleter.java b/bundles/org.eclipse.equinox.console/src/org/eclipse/equinox/console/completion/CommandNamesCompleter.java
index a73b0a57..81f163b3 100755
--- a/bundles/org.eclipse.equinox.console/src/org/eclipse/equinox/console/completion/CommandNamesCompleter.java
+++ b/bundles/org.eclipse.equinox.console/src/org/eclipse/equinox/console/completion/CommandNamesCompleter.java
@@ -73,7 +73,7 @@ public class CommandNamesCompleter implements Completer {
Set<String> clearedCommandNames = new HashSet<>();
for(String commandName : commandNames) {
- clearedCommandNames.add(commandName.substring(commandName.indexOf(":") + 1));
+ clearedCommandNames.add(commandName.substring(commandName.indexOf(':') + 1));
}
return clearedCommandNames;
diff --git a/bundles/org.eclipse.equinox.console/src/org/eclipse/equinox/console/telnet/TelnetCommand.java b/bundles/org.eclipse.equinox.console/src/org/eclipse/equinox/console/telnet/TelnetCommand.java
index 21108747..05ae84f7 100755
--- a/bundles/org.eclipse.equinox.console/src/org/eclipse/equinox/console/telnet/TelnetCommand.java
+++ b/bundles/org.eclipse.equinox.console/src/org/eclipse/equinox/console/telnet/TelnetCommand.java
@@ -76,7 +76,7 @@ public class TelnetCommand {
String telnetPort = null;
String consolePropValue = context.getProperty(CONSOLE_PROP);
if(consolePropValue != null) {
- int index = consolePropValue.lastIndexOf(":");
+ int index = consolePropValue.lastIndexOf(':');
if (index > -1) {
defaultHost = consolePropValue.substring(0, index);
}
diff --git a/bundles/org.eclipse.equinox.util/src/org/eclipse/equinox/internal/util/impl/tpt/timer/TimerImpl.java b/bundles/org.eclipse.equinox.util/src/org/eclipse/equinox/internal/util/impl/tpt/timer/TimerImpl.java
index 7c2aadc7..30b27a6d 100644
--- a/bundles/org.eclipse.equinox.util/src/org/eclipse/equinox/internal/util/impl/tpt/timer/TimerImpl.java
+++ b/bundles/org.eclipse.equinox.util/src/org/eclipse/equinox/internal/util/impl/tpt/timer/TimerImpl.java
@@ -58,7 +58,7 @@ public class TimerImpl implements Runnable {
}
th.start();
} catch (Exception e) {
- throw new RuntimeException("Can not start Timer thread!" + e.toString());
+ throw new RuntimeException("Can not start Timer thread!" + e);
}
}
diff --git a/bundles/org.eclipse.equinox.util/src/org/eclipse/equinox/internal/util/ref/Log.java b/bundles/org.eclipse.equinox.util/src/org/eclipse/equinox/internal/util/ref/Log.java
index 0f54a8a7..0e73cb62 100644
--- a/bundles/org.eclipse.equinox.util/src/org/eclipse/equinox/internal/util/ref/Log.java
+++ b/bundles/org.eclipse.equinox.util/src/org/eclipse/equinox/internal/util/ref/Log.java
@@ -630,14 +630,14 @@ public class Log implements LogInterface, ServiceTrackerCustomizer<LogService, L
StringBuilder sBuf = new StringBuilder(prefix).append("[");
String module = getModuleName(moduleID);
- sBuf.append(module != null ? module : "" + moduleID);
+ sBuf.append(module != null ? module : String.valueOf(moduleID));
sBuf.append(chars, 0, 2);
if (msgID != 0) {
// map msgID to String
String msg = getMsgValue(msgID);
- sBuf.append(msg != null ? msg : "" + msgID);
+ sBuf.append(msg != null ? msg : String.valueOf(msgID));
}
if (message != null)

Back to the top