diff options
author | Lars Vogel | 2019-06-19 15:25:13 +0000 |
---|---|---|
committer | Lars Vogel | 2019-06-20 17:00:38 +0000 |
commit | e9997e416c01f3c289af26d1fd24536a516192b3 (patch) | |
tree | f2746c056224617cb4b7398a5cace703a634caf4 | |
parent | 597dc31fa183f3aa7dfdaf008d166cb9e8db674c (diff) | |
download | rt.equinox.framework-e9997e416c01f3c289af26d1fd24536a516192b3.tar.gz rt.equinox.framework-e9997e416c01f3c289af26d1fd24536a516192b3.tar.xz rt.equinox.framework-e9997e416c01f3c289af26d1fd24536a516192b3.zip |
Small String optimizationI20190620-1800
Useless toString call in String concatination
Using String.valueOf instead of ""+
Use faster indexof('') version
Use appends(string, startI,EndI) directly
Change-Id: I937843410a4abc47803119e26073803fb1c1b115
Signed-off-by: Lars Vogel <Lars.Vogel@vogella.com>
3 files changed, 8 insertions, 8 deletions
diff --git a/bundles/org.eclipse.equinox.launcher/src/org/eclipse/equinox/launcher/Main.java b/bundles/org.eclipse.equinox.launcher/src/org/eclipse/equinox/launcher/Main.java index 71bea46d8..ee47cb76f 100644 --- a/bundles/org.eclipse.equinox.launcher/src/org/eclipse/equinox/launcher/Main.java +++ b/bundles/org.eclipse.equinox.launcher/src/org/eclipse/equinox/launcher/Main.java @@ -565,7 +565,7 @@ public class Main { if (protectBase && (System.getProperty(PROP_SHARED_CONFIG_AREA) == null)) { System.err.println("This application is configured to run in a cascaded mode only."); //$NON-NLS-1$ - System.setProperty(PROP_EXITCODE, "" + 14); //$NON-NLS-1$ + System.setProperty(PROP_EXITCODE, Integer.toString(14)); //$NON-NLS-1$ return; } // need to ensure that getInstallLocation is called at least once to initialize the value. @@ -822,7 +822,7 @@ public class Main { private void readFrameworkExtensions(URL base, ArrayList<URL> result) throws IOException { String[] extensions = getArrayFromList(System.getProperty(PROP_EXTENSIONS)); - String parent = new File(base.getFile()).getParent().toString(); + String parent = new File(base.getFile()).getParent(); ArrayList<String> extensionResults = new ArrayList<>(extensions.length); for (int i = 0; i < extensions.length; i++) { //Search the extension relatively to the osgi plugin @@ -2040,7 +2040,7 @@ public class Main { } try { if (debug) - System.out.print("Configuration file:\n " + url.toString()); //$NON-NLS-1$ + System.out.print("Configuration file:\n " + url); //$NON-NLS-1$ result = loadProperties(url); if (debug) System.out.println(" loaded"); //$NON-NLS-1$ @@ -2460,10 +2460,10 @@ public class Main { private StringBuilder appendPaddedInt(int value, int pad, StringBuilder buffer) { pad = pad - 1; if (pad == 0) - return buffer.append(Integer.toString(value)); + return buffer.append(value); int padding = (int) Math.pow(10, pad); if (value >= padding) - return buffer.append(Integer.toString(value)); + return buffer.append(value); while (padding > value && padding > 1) { buffer.append('0'); padding = padding / 10; @@ -2486,7 +2486,7 @@ public class Main { URL base = buildURL(System.getProperty(PROP_CONFIG_AREA), false); if (base == null) return; - logFile = new File(base.getPath(), Long.toString(System.currentTimeMillis()) + ".log"); //$NON-NLS-1$ + logFile = new File(base.getPath(), System.currentTimeMillis() + ".log"); //$NON-NLS-1$ new File(logFile.getParent()).mkdirs(); System.setProperty(PROP_LOGFILE, logFile.getAbsolutePath()); } diff --git a/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/storagemanager/StorageManager.java b/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/storagemanager/StorageManager.java index 8a2b22ece..c792c3155 100644 --- a/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/storagemanager/StorageManager.java +++ b/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/storagemanager/StorageManager.java @@ -553,7 +553,7 @@ public final class StorageManager { String value; if (entry.getFileType() != FILETYPE_STANDARD) { value = Integer.toString(entry.getWriteId() - 1) + ',' + //In the table we save the write number - 1, because the read number can be totally different. - Integer.toString(entry.getFileType()); + entry.getFileType(); } else { value = Integer.toString(entry.getWriteId() - 1); //In the table we save the write number - 1, because the read number can be totally different. } diff --git a/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/util/NLS.java b/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/util/NLS.java index a766e05a6..f438b7409 100644 --- a/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/util/NLS.java +++ b/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/util/NLS.java @@ -237,7 +237,7 @@ public abstract class NLS { break; } // otherwise write out the chars inside the quotes - buffer.append(message.substring(nextIndex, index)); + buffer.append(message, nextIndex, index); i = index; break; default : |