Bug 489706 - Remove custom Integer cache from P2

The OmniVersion provides a custom Integer cache, which apart from
storing the MAX_VALUE has no additional benefit over and above using the
built-in Integer cache. Replace calls to new Integer() with
Integer.valueOf()

Change-Id: Ibbcc0072a103bd16c7ef1e86a7962b9d88a5c1cb
Signed-off-by: Alex Blewitt <alex.blewitt@gmail.com>
diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/OmniVersion.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/OmniVersion.java
index 5a8e349..b5a6f63 100644
--- a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/OmniVersion.java
+++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/OmniVersion.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2009, 2010 Cloudsmith Inc. and others.
+ * Copyright (c) 2009, 2016 Cloudsmith Inc. and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -62,7 +62,7 @@
 			if (padValue == VersionVector.MAX_VALUE)
 				return (BasicVersion) MAX_VERSION;
 		}
-		if (vtop == 3 && padValue == null && vector.get(0) == VersionParser.ZERO_INT && vector.get(1) == VersionParser.ZERO_INT && vector.get(2) == VersionParser.ZERO_INT)
+		if (vtop == 3 && padValue == null && vector.get(0) == (Integer) 0 && vector.get(1) == (Integer) 0 && vector.get(2) == (Integer) 0)
 			return (BasicVersion) emptyVersion;
 
 		return new OmniVersion(vector, format, original);
diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/VersionParser.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/VersionParser.java
index 3b71bec..49fda09 100644
--- a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/VersionParser.java
+++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/VersionParser.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2009, 2010 Cloudsmith Inc. and others.
+ * Copyright (c) 2009, 2016 Cloudsmith Inc. and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -24,23 +24,10 @@
  * @noextend This class is not intended to be subclassed by clients.
  */
 public abstract class VersionParser {
-	public static final Integer ZERO_INT = new Integer(0);
-
-	public static final Integer MAX_INT_OBJ = new Integer(Integer.MAX_VALUE);
-
-	private static final Integer cache[] = new Integer[100];
-
-	static {
-		cache[0] = ZERO_INT;
-		for (int i = 1; i < cache.length; i++)
-			cache[i] = new Integer(i);
-	}
+	public static final Integer MAX_INT_OBJ = Integer.MAX_VALUE;
 
 	public static Integer valueOf(int i) {
-		if (i >= 0 && i < cache.length)
-			return cache[i];
-
-		return (i == Integer.MAX_VALUE) ? MAX_INT_OBJ : new Integer(i);
+		return (i == Integer.MAX_VALUE) ? MAX_INT_OBJ : Integer.valueOf(i);
 	}
 
 	static Comparable<?> removeRedundantTrail(List<Comparable<?>> segments, Comparable<?> padValue) {