Apply "Primitive parsing" JDT cleanup to platform.text
A boxed primitive is created from a String, just to extract the unboxed
primitive value.It is more efficient to just call the static parseXXX
method.
Before:
int number = Integer.valueOf("42", 8);
new Double("42.42").doubleValue();
After:
int number = Integer.parseInt("42", 8);
Double.parseDouble("42.42");
Change-Id: Ia26c247951013cae8dc345fd7cc1d8a7fdf711f3
Signed-off-by: Lars Vogel <Lars.Vogel@vogella.com>
diff --git a/org.eclipse.jface.text.examples/src/org/eclipse/jface/text/examples/sources/inlined/InlinedAnnotationDemo.java b/org.eclipse.jface.text.examples/src/org/eclipse/jface/text/examples/sources/inlined/InlinedAnnotationDemo.java
index e6e07e5..91a97ba 100644
--- a/org.eclipse.jface.text.examples/src/org/eclipse/jface/text/examples/sources/inlined/InlinedAnnotationDemo.java
+++ b/org.eclipse.jface.text.examples/src/org/eclipse/jface/text/examples/sources/inlined/InlinedAnnotationDemo.java
@@ -257,9 +257,9 @@
Matcher m = c.matcher(input);
if (m.matches()) {
try {
- return new Color(device, Integer.valueOf(m.group(1)), // r
- Integer.valueOf(m.group(2)), // g
- Integer.valueOf(m.group(3))); // b
+ return new Color(device, Integer.parseInt(m.group(1)), // r
+ Integer.parseInt(m.group(2)), // g
+ Integer.parseInt(m.group(3))); // b
} catch (Exception e) {
}
diff --git a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/MatchFilterSelectionDialog.java b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/MatchFilterSelectionDialog.java
index 382d986..cc8d74a 100644
--- a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/MatchFilterSelectionDialog.java
+++ b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/MatchFilterSelectionDialog.java
@@ -253,7 +253,7 @@
String text = fLimitElementsField.getText();
int value = -1;
try {
- value = Integer.valueOf(text).intValue();
+ value = Integer.parseInt(text);
} catch (NumberFormatException e) {
}
fLimitElementCount= value;
diff --git a/org.eclipse.text.quicksearch/src/org/eclipse/text/quicksearch/internal/ui/QuickSearchDialog.java b/org.eclipse.text.quicksearch/src/org/eclipse/text/quicksearch/internal/ui/QuickSearchDialog.java
index 610f33a..561494c 100644
--- a/org.eclipse.text.quicksearch/src/org/eclipse/text/quicksearch/internal/ui/QuickSearchDialog.java
+++ b/org.eclipse.text.quicksearch/src/org/eclipse/text/quicksearch/internal/ui/QuickSearchDialog.java
@@ -428,7 +428,7 @@
TableColumn col = table.getColumn(i);
try {
if (col!=null) {
- col.setWidth(Integer.valueOf(columnWidths[i]));
+ col.setWidth(Integer.parseInt(columnWidths[i]));
}
} catch (Throwable e) {
QuickSearchActivator.log(e);
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/rulers/ExtensionPointHelper.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/rulers/ExtensionPointHelper.java
index df52cf9..9fdb1ab 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/rulers/ExtensionPointHelper.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/rulers/ExtensionPointHelper.java
@@ -61,7 +61,7 @@
return dflt;
try {
- return Float.valueOf(value).floatValue();
+ return Float.parseFloat(value);
} catch (NumberFormatException x) {
fail(MessageFormat.format(RulerColumnMessages.ExtensionPointHelper_invalid_number_attribute_msg, attribute,
fName));