Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMickael Istria2016-03-10 09:06:46 +0000
committerMickael Istria2016-03-24 18:50:40 +0000
commit8c50a147d336c900c2103fffdb3c485f286d45ba (patch)
tree10290202cc391a5d61e8cb0ecda3b78b3eec5677 /bundles/org.eclipse.equinox.metatype
parentc0b5d56b195d220b4b22d172e1ac3b608a164234 (diff)
downloadrt.equinox.bundles-8c50a147d336c900c2103fffdb3c485f286d45ba.tar.gz
rt.equinox.bundles-8c50a147d336c900c2103fffdb3c485f286d45ba.tar.xz
rt.equinox.bundles-8c50a147d336c900c2103fffdb3c485f286d45ba.zip
Bug 489330 - Technical debt : Number instantiations
Save resources by using the Number factories (valueOf) rather than creating new instances. Change-Id: I285439a41bb102a88d893527f23366444ccafdbe Signed-off-by: Mickael Istria <mistria@redhat.com>
Diffstat (limited to 'bundles/org.eclipse.equinox.metatype')
-rw-r--r--bundles/org.eclipse.equinox.metatype/src/org/eclipse/equinox/metatype/impl/DataParser.java14
-rw-r--r--bundles/org.eclipse.equinox.metatype/src/org/eclipse/equinox/metatype/impl/MetaTypeServiceImpl.java4
-rw-r--r--bundles/org.eclipse.equinox.metatype/src/org/eclipse/equinox/metatype/impl/ValueTokenizer.java14
3 files changed, 16 insertions, 16 deletions
diff --git a/bundles/org.eclipse.equinox.metatype/src/org/eclipse/equinox/metatype/impl/DataParser.java b/bundles/org.eclipse.equinox.metatype/src/org/eclipse/equinox/metatype/impl/DataParser.java
index 91959f453..5128d9ab8 100644
--- a/bundles/org.eclipse.equinox.metatype/src/org/eclipse/equinox/metatype/impl/DataParser.java
+++ b/bundles/org.eclipse.equinox.metatype/src/org/eclipse/equinox/metatype/impl/DataParser.java
@@ -126,19 +126,19 @@ public class DataParser {
case AttributeDefinition.STRING :
return value;
case AttributeDefinition.LONG :
- return new Long(value);
+ return Long.valueOf(value);
case AttributeDefinition.INTEGER :
- return new Integer(value);
+ return Integer.valueOf(value);
case AttributeDefinition.SHORT :
- return new Short(value);
+ return Short.valueOf(value);
case AttributeDefinition.CHARACTER :
- return new Character(value.charAt(0));
+ return Character.valueOf(value.charAt(0));
case AttributeDefinition.BYTE :
- return new Byte(value);
+ return Byte.valueOf(value);
case AttributeDefinition.DOUBLE :
- return new Double(value);
+ return Double.valueOf(value);
case AttributeDefinition.FLOAT :
- return new Float(value);
+ return Float.valueOf(value);
case AttributeDefinition.BIGINTEGER :
return new BigInteger(value);
case AttributeDefinition.BIGDECIMAL :
diff --git a/bundles/org.eclipse.equinox.metatype/src/org/eclipse/equinox/metatype/impl/MetaTypeServiceImpl.java b/bundles/org.eclipse.equinox.metatype/src/org/eclipse/equinox/metatype/impl/MetaTypeServiceImpl.java
index 93c2e75a5..127de74e3 100644
--- a/bundles/org.eclipse.equinox.metatype/src/org/eclipse/equinox/metatype/impl/MetaTypeServiceImpl.java
+++ b/bundles/org.eclipse.equinox.metatype/src/org/eclipse/equinox/metatype/impl/MetaTypeServiceImpl.java
@@ -58,7 +58,7 @@ public class MetaTypeServiceImpl implements EquinoxMetaTypeService, SynchronousB
// Avoid synthetic accessor method warnings.
final LogService loggerTemp = this.logger;
final ServiceTracker<Object, Object> tracker = this.metaTypeProviderTracker;
- Long bID = new Long(b.getBundleId());
+ Long bID = Long.valueOf(b.getBundleId());
synchronized (_mtps) {
if (_mtps.containsKey(bID))
return _mtps.get(bID);
@@ -116,7 +116,7 @@ public class MetaTypeServiceImpl implements EquinoxMetaTypeService, SynchronousB
public void bundleChanged(BundleEvent event) {
int type = event.getType();
- Long bID = new Long(event.getBundle().getBundleId());
+ Long bID = Long.valueOf(event.getBundle().getBundleId());
switch (type) {
case BundleEvent.UPDATED :
diff --git a/bundles/org.eclipse.equinox.metatype/src/org/eclipse/equinox/metatype/impl/ValueTokenizer.java b/bundles/org.eclipse.equinox.metatype/src/org/eclipse/equinox/metatype/impl/ValueTokenizer.java
index d9160551d..4f374baaa 100644
--- a/bundles/org.eclipse.equinox.metatype/src/org/eclipse/equinox/metatype/impl/ValueTokenizer.java
+++ b/bundles/org.eclipse.equinox.metatype/src/org/eclipse/equinox/metatype/impl/ValueTokenizer.java
@@ -195,7 +195,7 @@ public class ValueTokenizer {
rangeError = validateString(ad, s);
break;
case AttributeDefinition.INTEGER :
- Integer intVal = new Integer(s);
+ Integer intVal = Integer.valueOf(s);
if (ad._minValue != null && intVal.compareTo((Integer) ad._minValue) < 0) {
rangeError = true;
} else if (ad._maxValue != null && intVal.compareTo((Integer) ad._maxValue) > 0) {
@@ -203,7 +203,7 @@ public class ValueTokenizer {
}
break;
case AttributeDefinition.LONG :
- Long longVal = new Long(s);
+ Long longVal = Long.valueOf(s);
if (ad._minValue != null && longVal.compareTo((Long) ad._minValue) < 0) {
rangeError = true;
} else if (ad._maxValue != null && longVal.compareTo((Long) ad._maxValue) > 0) {
@@ -211,7 +211,7 @@ public class ValueTokenizer {
}
break;
case AttributeDefinition.DOUBLE :
- Double doubleVal = new Double(s);
+ Double doubleVal = Double.valueOf(s);
if (ad._minValue != null && doubleVal.compareTo((Double) ad._minValue) < 0) {
rangeError = true;
} else if (ad._maxValue != null && doubleVal.compareTo((Double) ad._maxValue) > 0) {
@@ -223,7 +223,7 @@ public class ValueTokenizer {
// Seems unnecessary to impose any further restrictions.
break;
case AttributeDefinition.CHARACTER :
- Character charVal = new Character(s.charAt(0));
+ Character charVal = Character.valueOf(s.charAt(0));
if (ad._minValue != null && charVal.compareTo((Character) ad._minValue) < 0) {
rangeError = true;
} else if (ad._maxValue != null && charVal.compareTo((Character) ad._maxValue) > 0) {
@@ -231,7 +231,7 @@ public class ValueTokenizer {
}
break;
case AttributeDefinition.FLOAT :
- Float floatVal = new Float(s);
+ Float floatVal = Float.valueOf(s);
if (ad._minValue != null && floatVal.compareTo((Float) ad._minValue) < 0) {
rangeError = true;
} else if (ad._maxValue != null && floatVal.compareTo((Float) ad._maxValue) > 0) {
@@ -239,7 +239,7 @@ public class ValueTokenizer {
}
break;
case AttributeDefinition.SHORT :
- Short shortVal = new Short(s);
+ Short shortVal = Short.valueOf(s);
if (ad._minValue != null && shortVal.compareTo((Short) ad._minValue) < 0) {
rangeError = true;
} else if (ad._maxValue != null && shortVal.compareTo((Short) ad._maxValue) > 0) {
@@ -247,7 +247,7 @@ public class ValueTokenizer {
}
break;
case AttributeDefinition.BYTE :
- Byte byteVal = new Byte(s);
+ Byte byteVal = Byte.valueOf(s);
if (ad._minValue != null && byteVal.compareTo((Byte) ad._minValue) < 0) {
rangeError = true;
} else if (ad._maxValue != null && byteVal.compareTo((Byte) ad._maxValue) > 0) {

Back to the top