diff options
author | Lars Vogel | 2016-03-09 16:11:25 +0000 |
---|---|---|
committer | Lars Vogel | 2016-03-09 19:13:12 +0000 |
commit | 7c392ec6b3cbb83cde43785afbb39f175f00db81 (patch) | |
tree | f4320c58826125258b71bbb13bfb3ffbe4f70139 /bundles | |
parent | 1ae5c93eb0e0c741f3f7831bce8f3b5a906eeb02 (diff) | |
download | rt.equinox.framework-7c392ec6b3cbb83cde43785afbb39f175f00db81.tar.gz rt.equinox.framework-7c392ec6b3cbb83cde43785afbb39f175f00db81.tar.xz rt.equinox.framework-7c392ec6b3cbb83cde43785afbb39f175f00db81.zip |
Bug 489312 - Prefer usage of Integer.valueof instead of new() for org.eclipse.osgi
Change-Id: I8b1062796d0d1f49146d1d21876de2aab303ae2a
Signed-off-by: Lars Vogel <Lars.Vogel@vogella.com>
Diffstat (limited to 'bundles')
12 files changed, 19 insertions, 19 deletions
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/core/runtime/adaptor/EclipseStarter.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/core/runtime/adaptor/EclipseStarter.java index 07acf360c..1492cff74 100644 --- a/bundles/org.eclipse.osgi/container/src/org/eclipse/core/runtime/adaptor/EclipseStarter.java +++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/core/runtime/adaptor/EclipseStarter.java @@ -375,7 +375,7 @@ public class EclipseStarter { throw new IllegalStateException(Msg.ECLIPSE_STARTUP_NOT_RUNNING); // if we are just initializing, do not run the application just return. if (initialize) - return new Integer(0); + return Integer.valueOf(0); try { if (appLauncher == null) { boolean launchDefault = Boolean.valueOf(getProperty(PROP_APPLICATION_LAUNCHDEFAULT, "true")).booleanValue(); //$NON-NLS-1$ @@ -486,7 +486,7 @@ public class EclipseStarter { // keep this splash handler as the default startup monitor try { Dictionary<String, Object> monitorProps = new Hashtable<String, Object>(); - monitorProps.put(Constants.SERVICE_RANKING, new Integer(Integer.MIN_VALUE)); + monitorProps.put(Constants.SERVICE_RANKING, Integer.valueOf(Integer.MIN_VALUE)); defaultMonitorRegistration = context.registerService(StartupMonitor.class.getName(), new DefaultStartupMonitor(endSplashHandler, equinoxConfig), monitorProps); } catch (IllegalStateException e) { //splash handler did not provide the necessary methods, ignore it @@ -1262,7 +1262,7 @@ public class EclipseStarter { * returning anything else will cause exceptions in the caller. */ private static Object[] getVersionElements(String version) { - Object[] result = {new Integer(-1), new Integer(-1), new Integer(-1), ""}; //$NON-NLS-1$ + Object[] result = {Integer.valueOf(-1), Integer.valueOf(-1), Integer.valueOf(-1), ""}; //$NON-NLS-1$ StringTokenizer t = new StringTokenizer(version, "."); //$NON-NLS-1$ String token; for (int i = 0; t.hasMoreTokens() && i < 4; i++) { @@ -1270,7 +1270,7 @@ public class EclipseStarter { if (i < 3) { // major, minor or service ... numeric values try { - result[i] = new Integer(token); + result[i] = Integer.valueOf(token); } catch (Exception e) { if (i == 0) return null; // return null if no valid numbers are present diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/ModuleDatabase.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/ModuleDatabase.java index 72e4a94cb..70a26dd36 100644 --- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/ModuleDatabase.java +++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/ModuleDatabase.java @@ -947,13 +947,13 @@ public class ModuleDatabase { Integer cur = objectTable.get(object); if (cur != null) throw new IllegalStateException("Object is already in the write table: " + object); //$NON-NLS-1$ - objectTable.put(object, new Integer(objectTable.size())); + objectTable.put(object, Integer.valueOf(objectTable.size())); // return the index of the object just added (i.e. size - 1) return (objectTable.size() - 1); } private static void addToReadTable(Object object, int index, Map<Integer, Object> objectTable) { - objectTable.put(new Integer(index), object); + objectTable.put(Integer.valueOf(index), object); } public static void store(ModuleDatabase moduleDatabase, DataOutputStream out, boolean persistWirings) throws IOException { diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/SystemModule.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/SystemModule.java index 58cd1e93f..df498f62f 100644 --- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/SystemModule.java +++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/SystemModule.java @@ -31,7 +31,7 @@ public abstract class SystemModule extends Module { private final Map<Thread, ContainerEvent> forStop = new HashMap<Thread, ContainerEvent>(2); public SystemModule(ModuleContainer container) { - super(new Long(0), Constants.SYSTEM_BUNDLE_LOCATION, container, EnumSet.of(Settings.AUTO_START, Settings.USE_ACTIVATION_POLICY), new Integer(0)); + super(new Long(0), Constants.SYSTEM_BUNDLE_LOCATION, container, EnumSet.of(Settings.AUTO_START, Settings.USE_ACTIVATION_POLICY), Integer.valueOf(0)); } /** diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/container/ComputeNodeOrder.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/container/ComputeNodeOrder.java index 839d25e02..12ec3dd41 100644 --- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/container/ComputeNodeOrder.java +++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/container/ComputeNodeOrder.java @@ -362,8 +362,8 @@ public class ComputeNodeOrder { final int NEXT_ADJACENT = 3; final int AFTER_NEXTED_DFS_VISIT = 4; // use precomputed objects to avoid garbage - final Integer NEXT_VERTEX_OBJECT = new Integer(NEXT_VERTEX); - final Integer AFTER_NEXTED_DFS_VISIT_OBJECT = new Integer(AFTER_NEXTED_DFS_VISIT); + final Integer NEXT_VERTEX_OBJECT = Integer.valueOf(NEXT_VERTEX); + final Integer AFTER_NEXTED_DFS_VISIT_OBJECT = Integer.valueOf(AFTER_NEXTED_DFS_VISIT); // initialize // all vertex.color initially Vertex.WHITE; // all vertex.predecessor initially null; diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/SystemBundleActivator.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/SystemBundleActivator.java index 01d3b4fd4..1c61c3188 100644 --- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/SystemBundleActivator.java +++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/SystemBundleActivator.java @@ -220,7 +220,7 @@ public class SystemBundleActivator implements BundleActivator { Dictionary<String, String> headers = context.getBundle().getHeaders(); properties.put(Constants.SERVICE_VENDOR, headers.get(Constants.BUNDLE_VENDOR)); if (setRanking) { - properties.put(Constants.SERVICE_RANKING, new Integer(Integer.MAX_VALUE)); + properties.put(Constants.SERVICE_RANKING, Integer.valueOf(Integer.MAX_VALUE)); } properties.put(Constants.SERVICE_PID, context.getBundle().getBundleId() + "." + service.getClass().getName()); //$NON-NLS-1$ registrations.add(context.registerService(serviceClass, service, properties)); diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/log/EquinoxLogServices.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/log/EquinoxLogServices.java index 6fe4862a2..122b4dbaf 100644 --- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/log/EquinoxLogServices.java +++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/log/EquinoxLogServices.java @@ -118,7 +118,7 @@ public class EquinoxLogServices { Dictionary<String, String> headers = context.getBundle().getHeaders(); serviceProperties.put(Constants.SERVICE_VENDOR, headers.get(Constants.BUNDLE_VENDOR)); - serviceProperties.put(Constants.SERVICE_RANKING, new Integer(Integer.MIN_VALUE)); + serviceProperties.put(Constants.SERVICE_RANKING, Integer.valueOf(Integer.MIN_VALUE)); serviceProperties.put(Constants.SERVICE_PID, context.getBundle().getBundleId() + '.' + service.getClass().getName()); serviceProperties.put(FrameworkLog.SERVICE_PERFORMANCE, Boolean.TRUE.toString()); diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/log/EventAdminLogListener.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/log/EventAdminLogListener.java index ded0b8255..e8ef9de41 100644 --- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/log/EventAdminLogListener.java +++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/log/EventAdminLogListener.java @@ -113,7 +113,7 @@ public class EventAdminLogListener implements SynchronousLogListener { putServiceReferenceProperties(properties, ref); } properties.put(LOG_ENTRY, entry); - properties.put(LOG_LEVEL, new Integer(entry.getLevel())); + properties.put(LOG_LEVEL, Integer.valueOf(entry.getLevel())); if (entry.getMessage() != null) properties.put(MESSAGE, entry.getMessage()); properties.put(TIMESTAMP, new Long(entry.getTime())); diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/signedcontent/SignedBundleHook.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/signedcontent/SignedBundleHook.java index ce648ea4a..c29391094 100644 --- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/signedcontent/SignedBundleHook.java +++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/signedcontent/SignedBundleHook.java @@ -95,7 +95,7 @@ public class SignedBundleHook implements ActivatorHookFactory, BundleFileWrapper trustEngineListener = new TrustEngineListener(context, this); // always register the trust engine Dictionary<String, Object> trustEngineProps = new Hashtable<String, Object>(7); - trustEngineProps.put(Constants.SERVICE_RANKING, new Integer(Integer.MIN_VALUE)); + trustEngineProps.put(Constants.SERVICE_RANKING, Integer.valueOf(Integer.MIN_VALUE)); trustEngineProps.put(SignedContentConstants.TRUST_ENGINE, SignedContentConstants.DEFAULT_TRUST_ENGINE); KeyStoreTrustEngine systemTrustEngine = new KeyStoreTrustEngine(CACERTS_PATH, CACERTS_TYPE, null, "System", this); //$NON-NLS-1$ systemTrustEngineReg = context.registerService(TrustEngine.class.getName(), systemTrustEngine, trustEngineProps); diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/url/MultiplexingURLStreamHandler.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/url/MultiplexingURLStreamHandler.java index e6eff45f3..025e6a485 100644 --- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/url/MultiplexingURLStreamHandler.java +++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/url/MultiplexingURLStreamHandler.java @@ -185,7 +185,7 @@ public class MultiplexingURLStreamHandler extends URLStreamHandler { try { // set the real handler for the URL handlerField.set(arg0, handler); - parseURLMethod.invoke(handler, new Object[] {arg0, arg1, new Integer(arg2), new Integer(arg3)}); + parseURLMethod.invoke(handler, new Object[] {arg0, arg1, Integer.valueOf(arg2), Integer.valueOf(arg3)}); return; } catch (InvocationTargetException e) { throw (RuntimeException) e.getTargetException(); @@ -218,7 +218,7 @@ public class MultiplexingURLStreamHandler extends URLStreamHandler { try { // set the real handler for the URL handlerField.set(arg0, handler); - setURLMethod.invoke(handler, new Object[] {arg0, arg1, arg2, new Integer(arg3), arg4, arg5, arg6, arg7, arg8}); + setURLMethod.invoke(handler, new Object[] {arg0, arg1, arg2, Integer.valueOf(arg3), arg4, arg5, arg6, arg7, arg8}); return; } catch (InvocationTargetException e) { throw (RuntimeException) e.getTargetException(); diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/Storage.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/Storage.java index 0c460b1b6..2170875bd 100644 --- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/Storage.java +++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/Storage.java @@ -1734,7 +1734,7 @@ public class Storage { // in cases where the temp dir may already exist. Long bundleID = new Long(generation.getBundleInfo().getBundleId()); for (int i = 0; i < Integer.MAX_VALUE; i++) { - bundleTempDir = new File(libTempDir, bundleID.toString() + "_" + new Integer(i).toString()); //$NON-NLS-1$ + bundleTempDir = new File(libTempDir, bundleID.toString() + "_" + Integer.valueOf(i).toString()); //$NON-NLS-1$ libTempFile = new File(bundleTempDir, libName); if (bundleTempDir.exists()) { if (libTempFile.exists()) diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/StorageUtil.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/StorageUtil.java index 1cc6f9705..101f0617b 100644 --- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/StorageUtil.java +++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/StorageUtil.java @@ -154,7 +154,7 @@ public class StorageUtil { Dictionary<String, Object> properties = new Hashtable<String, Object>(7); Dictionary<String, String> headers = context.getBundle().getHeaders(); properties.put(Constants.SERVICE_VENDOR, headers.get(Constants.BUNDLE_VENDOR)); - properties.put(Constants.SERVICE_RANKING, new Integer(Integer.MAX_VALUE)); + properties.put(Constants.SERVICE_RANKING, Integer.valueOf(Integer.MAX_VALUE)); properties.put(Constants.SERVICE_PID, context.getBundle().getBundleId() + "." + service.getClass().getName()); //$NON-NLS-1$ return context.registerService(name, service, properties); } diff --git a/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/internal/reliablefile/ReliableFile.java b/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/internal/reliablefile/ReliableFile.java index 7ffbd8c0a..1cc893385 100644 --- a/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/internal/reliablefile/ReliableFile.java +++ b/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/internal/reliablefile/ReliableFile.java @@ -194,12 +194,12 @@ public class ReliableFile { return null; List<Integer> list = new ArrayList<Integer>(defaultMaxGenerations); if (file.exists()) - list.add(new Integer(0)); //base file exists + list.add(Integer.valueOf(0)); //base file exists for (int i = 0; i < files.length; i++) { if (files[i].startsWith(prefix)) { try { int id = Integer.parseInt(files[i].substring(prefixLen)); - list.add(new Integer(id)); + list.add(Integer.valueOf(id)); } catch (NumberFormatException e) {/*ignore*/ } } |