Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Vogel2018-01-23 06:07:48 -0500
committerAlexander Kurtakov2018-01-26 15:47:26 -0500
commit0ab33c4cb003b97e487d7626cf9bd90e3b7aceb8 (patch)
tree9c481697ed42fea1adbb229c586e4ce634f3d66a /examples
parent8870a999d1037323ab1dde25698f94f8b40b9abe (diff)
downloadeclipse.platform.swt-0ab33c4cb003b97e487d7626cf9bd90e3b7aceb8.tar.gz
eclipse.platform.swt-0ab33c4cb003b97e487d7626cf9bd90e3b7aceb8.tar.xz
eclipse.platform.swt-0ab33c4cb003b97e487d7626cf9bd90e3b7aceb8.zip
Bug 530166 - [Sonar] Performance - Method invokes inefficient Number
constructor; use static valueOf instead Sonar reports issues in org.eclipse.swt.examples, which should be fixed Change-Id: Ic55348a56f75991dcb2d9147add97e8c47610e85 Signed-off-by: Lars Vogel <Lars.Vogel@vogella.com>
Diffstat (limited to 'examples')
-rw-r--r--examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/layoutexample/FormLayoutTab.java10
-rw-r--r--examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/layoutexample/GridLayoutTab.java12
2 files changed, 11 insertions, 11 deletions
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/layoutexample/FormLayoutTab.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/layoutexample/FormLayoutTab.java
index 202f7b79ab..04d4bfe768 100644
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/layoutexample/FormLayoutTab.java
+++ b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/layoutexample/FormLayoutTab.java
@@ -385,7 +385,7 @@ class FormLayoutTab extends Tab {
if (data.right.control != null) {
TableItem item = table.getItem (i);
String controlString = item.getText (RIGHT_COL);
- int index = new Integer (controlString.substring (controlString.indexOf (',') - 1, controlString.indexOf (','))).intValue ();
+ int index = Integer.valueOf (controlString.substring (controlString.indexOf (',') - 1, controlString.indexOf (',')));
code.append ("\t\tdata.right = new FormAttachment (" + names [index] + ", " + data.right.offset + ", SWT." + alignmentString (data.right.alignment) + ");\n");
} else {
code.append ("\t\tdata.right = new FormAttachment (" + data.right.numerator + ", " + data.right.offset + ");\n");
@@ -395,7 +395,7 @@ class FormLayoutTab extends Tab {
if (data.top.control != null) {
TableItem item = table.getItem (i);
String controlString = item.getText (TOP_COL);
- int index = new Integer (controlString.substring (controlString.indexOf (',') - 1, controlString.indexOf (','))).intValue ();
+ int index = Integer.valueOf(controlString.substring (controlString.indexOf (',') - 1, controlString.indexOf (',')));
code.append ("\t\tdata.top = new FormAttachment (" + names [index] + ", " + data.top.offset + ", SWT." + alignmentString (data.top.alignment) + ");\n");
} else {
if (data.bottom != null || (data.top.numerator != 0 ||data.top.offset != 0)) {
@@ -407,7 +407,7 @@ class FormLayoutTab extends Tab {
if (data.bottom.control != null) {
TableItem item = table.getItem (i);
String controlString = item.getText (BOTTOM_COL);
- int index = new Integer (controlString.substring (controlString.indexOf (',') - 1, controlString.indexOf (','))).intValue ();
+ int index = Integer.valueOf(controlString.substring (controlString.indexOf (',') - 1, controlString.indexOf (',')));
code.append ("\t\tdata.bottom = new FormAttachment (" + names [index] + ", " + data.bottom.offset + ", SWT." + alignmentString (data.bottom.alignment) + ");\n");
} else {
code.append ("\t\tdata.bottom = new FormAttachment (" + data.bottom.numerator + ", " + data.bottom.offset + ");\n");
@@ -530,12 +530,12 @@ class FormLayoutTab extends Tab {
} else {
/* Case where there is a position */
try {
- position = new Integer (attachment.substring (0,comma)).intValue ();
+ position = Integer.valueOf(attachment.substring (0,comma));
} catch (NumberFormatException e) {
position = 0;
}
try {
- offset = new Integer (attachment.substring (comma + 1)).intValue ();
+ offset = Integer.valueOf(attachment.substring (comma + 1));
} catch (NumberFormatException e) {
offset = 0;
}
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/layoutexample/GridLayoutTab.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/layoutexample/GridLayoutTab.java
index 941287bd6c..fa9358968e 100644
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/layoutexample/GridLayoutTab.java
+++ b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/layoutexample/GridLayoutTab.java
@@ -644,13 +644,13 @@ class GridLayoutTab extends Tab {
data.verticalAlignment = SWT.CENTER;
}
/* Set spans and indents */
- hSpan = new Integer (items [i].getText (HSPAN_COL)).intValue ();
+ hSpan = Integer.valueOf (items [i].getText (HSPAN_COL));
data.horizontalSpan = hSpan;
- vSpan = new Integer (items [i].getText (VSPAN_COL)).intValue ();
+ vSpan = Integer.valueOf(items [i].getText (VSPAN_COL));
data.verticalSpan = vSpan;
- hIndent = new Integer (items [i].getText (HINDENT_COL)).intValue ();
+ hIndent = Integer.valueOf(items [i].getText (HINDENT_COL));
data.horizontalIndent = hIndent;
- vIndent = new Integer (items [i].getText (VINDENT_COL)).intValue ();
+ vIndent = Integer.valueOf(items [i].getText (VINDENT_COL));
data.verticalIndent = vIndent;
/* Set grabs */
hGrab = items [i].getText (HGRAB_COL);
@@ -658,8 +658,8 @@ class GridLayoutTab extends Tab {
vGrab = items [i].getText (VGRAB_COL);
data.grabExcessVerticalSpace = vGrab.equals ("true");
/* Set minimum width and height */
- data.minimumWidth = new Integer (items [i].getText (MINWIDTH_COL)).intValue ();
- data.minimumHeight = new Integer (items [i].getText (MINHEIGHT_COL)).intValue ();
+ data.minimumWidth = Integer.valueOf(items [i].getText (MINWIDTH_COL));
+ data.minimumHeight = Integer.valueOf(items [i].getText (MINHEIGHT_COL));
/* Set exclude boolean */
exclude = items [i].getText (EXCLUDE_COL);
data.exclude = exclude.equals ("true");

Back to the top