Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Blewitt2016-03-15 23:32:55 +0000
committerJay Arthanareeswaran2016-04-05 15:56:03 +0000
commit6cb38423959485832f6b2b451a0cc3345d452e56 (patch)
tree80758269cf032cf884844dde1eafbd6fdc04231b /org.eclipse.jdt.core.tests.builder
parentab49196ce45436d53b4eaed402b4d09d2547be3c (diff)
downloadeclipse.jdt.core-6cb38423959485832f6b2b451a0cc3345d452e56.tar.gz
eclipse.jdt.core-6cb38423959485832f6b2b451a0cc3345d452e56.tar.xz
eclipse.jdt.core-6cb38423959485832f6b2b451a0cc3345d452e56.zip
Bug 489702 - Replace new PrimitiveWrapper() with .valueOf()
The primitive wrapper classes (Byte, Short, Character, Integer, Long) all have a constructor that takes a String (or primitive) value and return a new instance wrapping that type. They also have a valueOf method which does the same thing, but without creating a new object instance. Replace calls to the constructor and in-line calls where the object creation doesn't escape (for example, new Integer().intValue() or equivalent). Change-Id: I70310f46c085879b6efa28740186426de59c81b5 Signed-off-by: Alex Blewitt <alex.blewitt@gmail.com>
Diffstat (limited to 'org.eclipse.jdt.core.tests.builder')
-rw-r--r--org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/BasicBuildTests.java22
1 files changed, 11 insertions, 11 deletions
diff --git a/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/BasicBuildTests.java b/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/BasicBuildTests.java
index 6820f35088..738bc66138 100644
--- a/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/BasicBuildTests.java
+++ b/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/BasicBuildTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2015 IBM Corporation and others.
+ * Copyright (c) 2000, 2016 IBM Corporation 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
@@ -141,21 +141,21 @@ public class BasicBuildTests extends BuilderTests {
String message = (String) marker.getAttribute(IMarker.MESSAGE);
assertTrue("Wrong message", message.startsWith("TODO "));
assertNotNull("No task priority", priority);
- assertEquals("Wrong priority", new Integer(IMarker.PRIORITY_NORMAL), priority);
+ assertEquals("Wrong priority", Integer.valueOf(IMarker.PRIORITY_NORMAL), priority);
marker = markers[1];
priority = marker.getAttribute(IMarker.PRIORITY);
message = (String) marker.getAttribute(IMarker.MESSAGE);
assertTrue("Wrong message", message.startsWith("FIXME "));
assertNotNull("No task priority", priority);
- assertEquals("Wrong priority", new Integer(IMarker.PRIORITY_HIGH), priority);
+ assertEquals("Wrong priority", Integer.valueOf(IMarker.PRIORITY_HIGH), priority);
marker = markers[2];
priority = marker.getAttribute(IMarker.PRIORITY);
message = (String) marker.getAttribute(IMarker.MESSAGE);
assertTrue("Wrong message", message.startsWith("XXX "));
assertNotNull("No task priority", priority);
- assertEquals("Wrong priority", new Integer(IMarker.PRIORITY_LOW), priority);
+ assertEquals("Wrong priority", Integer.valueOf(IMarker.PRIORITY_LOW), priority);
} catch (CoreException e) {
assertTrue(false);
}
@@ -197,21 +197,21 @@ public class BasicBuildTests extends BuilderTests {
String message = (String) marker.getAttribute(IMarker.MESSAGE);
assertEquals("Wrong message", "TODO should be done", message);
assertNotNull("No task priority", priority);
- assertEquals("Wrong priority", new Integer(IMarker.PRIORITY_NORMAL), priority);
+ assertEquals("Wrong priority", Integer.valueOf(IMarker.PRIORITY_NORMAL), priority);
marker = markers[1];
priority = marker.getAttribute(IMarker.PRIORITY);
message = (String) marker.getAttribute(IMarker.MESSAGE);
assertEquals("Wrong message", "FIXME need to review the loop", message);
assertNotNull("No task priority", priority);
- assertEquals("Wrong priority", new Integer(IMarker.PRIORITY_HIGH), priority);
+ assertEquals("Wrong priority", Integer.valueOf(IMarker.PRIORITY_HIGH), priority);
marker = markers[0];
priority = marker.getAttribute(IMarker.PRIORITY);
message = (String) marker.getAttribute(IMarker.MESSAGE);
assertEquals("Wrong message", "TODO need to review the loop", message);
assertNotNull("No task priority", priority);
- assertEquals("Wrong priority", new Integer(IMarker.PRIORITY_NORMAL), priority);
+ assertEquals("Wrong priority", Integer.valueOf(IMarker.PRIORITY_NORMAL), priority);
} catch (CoreException e) {
assertTrue(false);
}
@@ -253,14 +253,14 @@ public class BasicBuildTests extends BuilderTests {
String message = (String) marker.getAttribute(IMarker.MESSAGE);
assertEquals("Wrong message", "TODO need to review the loop", message);
assertNotNull("No task priority", priority);
- assertEquals("Wrong priority", new Integer(IMarker.PRIORITY_NORMAL), priority);
+ assertEquals("Wrong priority", Integer.valueOf(IMarker.PRIORITY_NORMAL), priority);
marker = markers[0];
priority = marker.getAttribute(IMarker.PRIORITY);
message = (String) marker.getAttribute(IMarker.MESSAGE);
assertEquals("Wrong message", "TODO need to review the loop", message);
assertNotNull("No task priority", priority);
- assertEquals("Wrong priority", new Integer(IMarker.PRIORITY_NORMAL), priority);
+ assertEquals("Wrong priority", Integer.valueOf(IMarker.PRIORITY_NORMAL), priority);
} catch (CoreException e) {
assertTrue(false);
}
@@ -508,14 +508,14 @@ public class BasicBuildTests extends BuilderTests {
String message = (String) marker.getAttribute(IMarker.MESSAGE);
assertEquals("Wrong message", "TODO? need to review the loop", message);
assertNotNull("No task priority", priority);
- assertEquals("Wrong priority", new Integer(IMarker.PRIORITY_LOW), priority);
+ assertEquals("Wrong priority", Integer.valueOf(IMarker.PRIORITY_LOW), priority);
marker = markers[0];
priority = marker.getAttribute(IMarker.PRIORITY);
message = (String) marker.getAttribute(IMarker.MESSAGE);
assertEquals("Wrong message", "TODO! need to review the loop", message);
assertNotNull("No task priority", priority);
- assertEquals("Wrong priority", new Integer(IMarker.PRIORITY_HIGH), priority);
+ assertEquals("Wrong priority", Integer.valueOf(IMarker.PRIORITY_HIGH), priority);
} catch (CoreException e) {
assertTrue(false);
}

Back to the top