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.apt.tests/src-annotations
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.apt.tests/src-annotations')
-rw-r--r--org.eclipse.jdt.apt.tests/src-annotations/org/eclipse/jdt/apt/tests/annotations/mirrortest/MirrorDeclarationTestAnnotationProcessor.java4
1 files changed, 2 insertions, 2 deletions
diff --git a/org.eclipse.jdt.apt.tests/src-annotations/org/eclipse/jdt/apt/tests/annotations/mirrortest/MirrorDeclarationTestAnnotationProcessor.java b/org.eclipse.jdt.apt.tests/src-annotations/org/eclipse/jdt/apt/tests/annotations/mirrortest/MirrorDeclarationTestAnnotationProcessor.java
index bf32611d39..d7e40fe52c 100644
--- a/org.eclipse.jdt.apt.tests/src-annotations/org/eclipse/jdt/apt/tests/annotations/mirrortest/MirrorDeclarationTestAnnotationProcessor.java
+++ b/org.eclipse.jdt.apt.tests/src-annotations/org/eclipse/jdt/apt/tests/annotations/mirrortest/MirrorDeclarationTestAnnotationProcessor.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2014 BEA Systems, Inc. and others
+ * Copyright (c) 2005, 2016 BEA Systems, Inc. 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
@@ -136,7 +136,7 @@ public class MirrorDeclarationTestAnnotationProcessor extends BaseProcessor {
ProcessorTestStatus.assertTrue("position should be null", posVS == null); // the anno is declared in binary - no AST.
AnnotationValue valueInt = elementInt.getDefaultValue();
ProcessorTestStatus.assertEquals("", "bob", valueString.getValue());
- ProcessorTestStatus.assertEquals("", new Integer(3), valueInt.getValue());
+ ProcessorTestStatus.assertEquals("", Integer.valueOf(3), valueInt.getValue());
ProcessorTestStatus.assertEquals("", "\"bob\"", valueString.toString());
ProcessorTestStatus.assertEquals("", "3", valueInt.toString());
}

Back to the top