Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Vogel2021-03-26 11:07:59 +0000
committerLars Vogel2021-03-29 12:35:13 +0000
commitc53b30f69e5521084602c893ad9c0affd0e27f2e (patch)
treef994b9dcc6e264b9a64c5783fb23fa53436800b5
parentcac985e9998249f85783501b90a88f38073c300a (diff)
downloadeclipse.platform.text-c53b30f69e5521084602c893ad9c0affd0e27f2e.tar.gz
eclipse.platform.text-c53b30f69e5521084602c893ad9c0affd0e27f2e.tar.xz
eclipse.platform.text-c53b30f69e5521084602c893ad9c0affd0e27f2e.zip
Apply "Primitive parsing" JDT cleanup to platform.textI20210331-1800I20210330-1800
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>
-rw-r--r--org.eclipse.jface.text.examples/src/org/eclipse/jface/text/examples/sources/inlined/InlinedAnnotationDemo.java6
-rw-r--r--org.eclipse.search/new search/org/eclipse/search2/internal/ui/MatchFilterSelectionDialog.java2
-rw-r--r--org.eclipse.text.quicksearch/src/org/eclipse/text/quicksearch/internal/ui/QuickSearchDialog.java2
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/rulers/ExtensionPointHelper.java2
4 files changed, 6 insertions, 6 deletions
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 e6e07e52f16..91a97ba6308 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 @@ public class InlinedAnnotationDemo {
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 382d986a3c0..cc8d74af1f5 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 @@ public class MatchFilterSelectionDialog extends StatusDialog {
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 610f33a9b2f..561494ca0e9 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 @@ public class QuickSearchDialog extends SelectionStatusDialog {
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 df52cf951f5..9fdb1ab1282 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 @@ public final class ExtensionPointHelper {
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));

Back to the top