1
0
mirror of synced 2026-08-05 17:57:15 +00:00

Use Integer.valueOf() in preference to new Integer()

This commit is contained in:
Luke Taylor
2010-08-11 18:17:23 +01:00
parent db6da77a5f
commit 2222a7be07
18 changed files with 49 additions and 43 deletions
@@ -28,7 +28,7 @@ public class TargetObject implements ITargetObject {
//~ Methods ========================================================================================================
public Integer computeHashCode(String input) {
return new Integer(input.hashCode());
return Integer.valueOf(input.hashCode());
}
public int countLength(String input) {
@@ -74,7 +74,7 @@ public class SecurityConfigTests {
MockConfigAttribute mock2 = new MockConfigAttribute("NOT_EQUAL");
Assert.assertTrue(!security1.equals(mock2));
Integer int1 = new Integer(987);
Integer int1 = Integer.valueOf(987);
Assert.assertTrue(!security1.equals(int1));
}
@@ -85,7 +85,7 @@ public class AfterInvocationProviderManagerTests extends TestCase {
AfterInvocationProviderManager manager = new AfterInvocationProviderManager();
List list = new Vector();
list.add(new MockAfterInvocationProvider("swap1", MethodInvocation.class, new SecurityConfig("GIVE_ME_SWAP1")));
list.add(new Integer(45));
list.add(Integer.valueOf(45));
list.add(new MockAfterInvocationProvider("swap3", MethodInvocation.class, new SecurityConfig("GIVE_ME_SWAP3")));
try {
@@ -95,7 +95,7 @@ public class AbstractAuthenticationTokenTests {
assertTrue(!token1.equals(token7));
assertTrue(!token7.equals(token1));
assertTrue(!token1.equals(new Integer(100)));
assertTrue(!token1.equals(Integer.valueOf(100)));
}
@Test
@@ -50,7 +50,7 @@ public class GrantedAuthorityImplTests {
MockGrantedAuthority mock2 = new MockGrantedAuthority("NOT_EQUAL");
assertTrue(!auth1.equals(mock2));
Integer int1 = new Integer(222);
Integer int1 = Integer.valueOf(222);
assertTrue(!auth1.equals(int1));
}
@@ -25,7 +25,7 @@ public class KeyBasedPersistenceTokenServiceTests {
SecureRandomFactoryBean fb = new SecureRandomFactoryBean();
KeyBasedPersistenceTokenService service = new KeyBasedPersistenceTokenService();
service.setServerSecret("MY:SECRET$$$#");
service.setServerInteger(new Integer(454545));
service.setServerInteger(Integer.valueOf(454545));
try {
SecureRandom rnd = (SecureRandom) fb.getObject();
service.setSecureRandom(rnd);