Skip to content
Permalink
Browse files
8254271: Development to deprecate wrapper class constructors for removal
Reviewed-by: mchung
  • Loading branch information
Roger Riggs committed Nov 6, 2020
1 parent 2ac97b2 commit 0c2ef39c2ae1632ddb77f0475dff89004825110c
Showing 21 changed files with 115 additions and 49 deletions.
@@ -99,7 +99,7 @@ public final class Boolean implements java.io.Serializable,
* Also consider using the final fields {@link #TRUE} and {@link #FALSE}
* if possible.
*/
@Deprecated(since="9")
@Deprecated(since="9", forRemoval = true)
public Boolean(boolean value) {
this.value = value;
}
@@ -119,7 +119,7 @@ public Boolean(boolean value) {
* {@code boolean} primitive, or use {@link #valueOf(String)}
* to convert a string to a {@code Boolean} object.
*/
@Deprecated(since="9")
@Deprecated(since="9", forRemoval = true)
public Boolean(String s) {
this(parseBoolean(s));
}
@@ -338,7 +338,7 @@ public static Byte decode(String nm) throws NumberFormatException {
* {@link #valueOf(byte)} is generally a better choice, as it is
* likely to yield significantly better space and time performance.
*/
@Deprecated(since="9")
@Deprecated(since="9", forRemoval = true)
public Byte(byte value) {
this.value = value;
}
@@ -361,7 +361,7 @@ public Byte(byte value) {
* {@code byte} primitive, or use {@link #valueOf(String)}
* to convert a string to a {@code Byte} object.
*/
@Deprecated(since="9")
@Deprecated(since="9", forRemoval = true)
public Byte(String s) throws NumberFormatException {
this.value = parseByte(s, 10);
}
@@ -8502,7 +8502,7 @@ public static final UnicodeScript forName(String scriptName) {
* {@link #valueOf(char)} is generally a better choice, as it is
* likely to yield significantly better space and time performance.
*/
@Deprecated(since="9")
@Deprecated(since="9", forRemoval = true)
public Character(char value) {
this.value = value;
}
@@ -606,7 +606,7 @@ public static boolean isFinite(double d) {
* {@link #valueOf(double)} is generally a better choice, as it is
* likely to yield significantly better space and time performance.
*/
@Deprecated(since="9")
@Deprecated(since="9", forRemoval = true)
public Double(double value) {
this.value = value;
}
@@ -627,7 +627,7 @@ public Double(double value) {
* {@code double} primitive, or use {@link #valueOf(String)}
* to convert a string to a {@code Double} object.
*/
@Deprecated(since="9")
@Deprecated(since="9", forRemoval = true)
public Double(String s) throws NumberFormatException {
value = parseDouble(s);
}
@@ -519,7 +519,7 @@ public static boolean isFinite(float f) {
* {@link #valueOf(float)} is generally a better choice, as it is
* likely to yield significantly better space and time performance.
*/
@Deprecated(since="9")
@Deprecated(since="9", forRemoval = true)
public Float(float value) {
this.value = value;
}
@@ -535,7 +535,7 @@ public Float(float value) {
* static factory method {@link #valueOf(float)} method as follows:
* {@code Float.valueOf((float)value)}.
*/
@Deprecated(since="9")
@Deprecated(since="9", forRemoval = true)
public Float(double value) {
this.value = (float)value;
}
@@ -556,7 +556,7 @@ public Float(double value) {
* {@code float} primitive, or use {@link #valueOf(String)}
* to convert a string to a {@code Float} object.
*/
@Deprecated(since="9")
@Deprecated(since="9", forRemoval = true)
public Float(String s) throws NumberFormatException {
value = parseFloat(s);
}
@@ -1086,7 +1086,7 @@ public static Integer valueOf(int i) {
* {@link #valueOf(int)} is generally a better choice, as it is
* likely to yield significantly better space and time performance.
*/
@Deprecated(since="9")
@Deprecated(since="9", forRemoval = true)
public Integer(int value) {
this.value = value;
}
@@ -1108,7 +1108,7 @@ public Integer(int value) {
* {@code int} primitive, or use {@link #valueOf(String)}
* to convert a string to an {@code Integer} object.
*/
@Deprecated(since="9")
@Deprecated(since="9", forRemoval = true)
public Integer(String s) throws NumberFormatException {
this.value = parseInt(s, 10);
}
@@ -1317,7 +1317,7 @@ else if (nm.startsWith("0", index) && nm.length() > 1 + index) {
* {@link #valueOf(long)} is generally a better choice, as it is
* likely to yield significantly better space and time performance.
*/
@Deprecated(since="9")
@Deprecated(since="9", forRemoval = true)
public Long(long value) {
this.value = value;
}
@@ -1340,7 +1340,7 @@ public Long(long value) {
* {@code long} primitive, or use {@link #valueOf(String)}
* to convert a string to a {@code Long} object.
*/
@Deprecated(since="9")
@Deprecated(since="9", forRemoval = true)
public Long(String s) throws NumberFormatException {
this.value = parseLong(s, 10);
}
@@ -343,7 +343,7 @@ public static Short decode(String nm) throws NumberFormatException {
* {@link #valueOf(short)} is generally a better choice, as it is
* likely to yield significantly better space and time performance.
*/
@Deprecated(since="9")
@Deprecated(since="9", forRemoval = true)
public Short(short value) {
this.value = value;
}
@@ -366,7 +366,7 @@ public Short(short value) {
* {@code short} primitive, or use {@link #valueOf(String)}
* to convert a string to a {@code Short} object.
*/
@Deprecated(since="9")
@Deprecated(since="9", forRemoval = true)
public Short(String s) throws NumberFormatException {
this.value = parseShort(s, 10);
}
@@ -773,7 +773,7 @@ public MemberName getDefinition() {
}

@Override
@SuppressWarnings("deprecation")
@SuppressWarnings({"deprecation", "removal"})
public int hashCode() {
// Avoid autoboxing getReferenceKind(), since this is used early and will force
// early initialization of Byte$ByteCache
@@ -258,7 +258,10 @@ public javax.management.ObjectInstance createMBean(java.lang.String $param_Strin
public javax.management.remote.NotificationResult fetchNotifications(long $param_long_1, int $param_int_2, long $param_long_3)
throws java.io.IOException {
try {
Object $result = ref.invoke(this, $method_fetchNotifications_7, new java.lang.Object[]{new java.lang.Long($param_long_1), new java.lang.Integer($param_int_2), new java.lang.Long($param_long_3)}, -5037523307973544478L);
Object $result = ref.invoke(this, $method_fetchNotifications_7,
new java.lang.Object[]{java.lang.Long.valueOf($param_long_1),
java.lang.Integer.valueOf($param_int_2),
java.lang.Long.valueOf($param_long_3)}, -5037523307973544478L);
return ((javax.management.remote.NotificationResult) $result);
} catch (java.lang.RuntimeException e) {
throw e;
@@ -4013,7 +4013,8 @@ else if (componentType.equals(SchemaSymbols.ELT_ATTRIBUTEGROUP)) {
","+oldName:currSchema.fTargetNamespace+","+oldName;
int attGroupRefsCount = changeRedefineGroup(processedBaseName, componentType, newName, child, currSchema);
if (attGroupRefsCount > 1) {
reportSchemaError("src-redefine.7.1", new Object []{new Integer(attGroupRefsCount)}, child);
reportSchemaError("src-redefine.7.1",
new Object []{Integer.valueOf(attGroupRefsCount)}, child);
}
else if (attGroupRefsCount == 1) {
// return true;
@@ -4029,7 +4030,7 @@ else if (componentType.equals(SchemaSymbols.ELT_GROUP)) {
","+oldName:currSchema.fTargetNamespace+","+oldName;
int groupRefsCount = changeRedefineGroup(processedBaseName, componentType, newName, child, currSchema);
if (groupRefsCount > 1) {
reportSchemaError("src-redefine.6.1.1", new Object []{new Integer(groupRefsCount)}, child);
reportSchemaError("src-redefine.6.1.1", new Object []{Integer.valueOf(groupRefsCount)}, child);
}
else if (groupRefsCount == 1) {
// return true;
@@ -438,8 +438,8 @@ private static void initialize()
private static void defineEntity( String name, char value )
{
if ( _byName.get( name ) == null ) {
_byName.put( name, new Integer( value ) );
_byChar.put( new Integer( value ), name );
_byName.put( name, Integer.valueOf( value ) );
_byChar.put( Integer.valueOf( value ), name );
}
}

@@ -133,7 +133,7 @@ public int hashCode(Object o) {
Assert.assertTrue(set.add(newInteger(0)));
}

@SuppressWarnings({"deprecation", "unused"})
@SuppressWarnings({"deprecation", "removal", "unused"})
private static Integer newInteger(int value) {
return new Integer(value);
}
@@ -161,7 +161,7 @@ public void testSetRemoval() {
Assert.assertEquals(newInteger(9), finalList.get(0));
}

@SuppressWarnings({"deprecation", "unused"})
@SuppressWarnings({"deprecation", "removal", "unused"})
private static Integer newInteger(int value) {
return new Integer(value);
}
@@ -58,7 +58,7 @@ public void test1() {
testEscapeAnalysis("test1Snippet", JavaConstant.forInt(101), false);
}

@SuppressWarnings("deprecation")
@SuppressWarnings({"deprecation", "removal"})
public static int test1Snippet() {
Integer x = new Integer(101);
return x.intValue();
@@ -89,7 +89,7 @@ public void testMonitor() {
testEscapeAnalysis("testMonitorSnippet", JavaConstant.forInt(0), false);
}

@SuppressWarnings("deprecation")
@SuppressWarnings({"deprecation", "removal"})
public static int testMonitorSnippet() {
Integer x = new Integer(0);
Double y = new Double(0);
@@ -113,7 +113,7 @@ public void testMonitor2() {
* This test case differs from the last one in that it requires inlining within a synchronized
* region.
*/
@SuppressWarnings("deprecation")
@SuppressWarnings({"deprecation", "removal"})
public static int testMonitor2Snippet() {
Integer x = new Integer(0);
Double y = new Double(0);
@@ -335,7 +335,7 @@ public void testChangeHandling() {

public volatile Object field;

@SuppressWarnings("deprecation")
@SuppressWarnings({"deprecation", "removal"})
public int testChangeHandlingSnippet(int a) {
Object obj;
Integer one = 1;
@@ -42,7 +42,7 @@ protected OptimisticOptimizations getOptimisticOptimizations() {

public static Object field;

@SuppressWarnings({"deprecation", "unused"})
@SuppressWarnings({"deprecation", "removal", "unused"})
public static void snippet1(int i) {
Integer object = new Integer(i);
GraalDirectives.ensureVirtualized(object);
@@ -53,7 +53,7 @@ public void test1() {
test("snippet1", 1);
}

@SuppressWarnings({"deprecation", "unused"})
@SuppressWarnings({"deprecation", "removal", "unused"})
public static void snippet2(int i) {
Integer object = new Integer(i);
GraalDirectives.ensureVirtualized(object);
@@ -65,7 +65,7 @@ public void test2() {
test("snippet2", 1);
}

@SuppressWarnings({"deprecation", "unused"})
@SuppressWarnings({"deprecation", "removal", "unused"})
public static void snippet3(int i) {
Integer object = new Integer(i);
field = object;
@@ -77,7 +77,7 @@ public void test3() {
test("snippet3", 1);
}

@SuppressWarnings({"deprecation", "unused"})
@SuppressWarnings({"deprecation", "removal", "unused"})
public static void snippetHere1(int i) {
Integer object = new Integer(i);
GraalDirectives.ensureVirtualizedHere(object);
@@ -88,7 +88,7 @@ public void testHere1() {
test("snippetHere1", 1);
}

@SuppressWarnings({"deprecation", "unused"})
@SuppressWarnings({"deprecation", "removal", "unused"})
public static void snippetHere2(int i) {
Integer object = new Integer(i);
GraalDirectives.ensureVirtualizedHere(object);
@@ -100,7 +100,7 @@ public void testHere2() {
test("snippetHere2", 1);
}

@SuppressWarnings({"deprecation", "unused"})
@SuppressWarnings({"deprecation", "removal", "unused"})
public static void snippetHere3(int i) {
Integer object = new Integer(i);
field = object;
@@ -133,7 +133,7 @@ public void testBoxing2() {
test("snippetBoxing2", 1);
}

@SuppressWarnings({"deprecation", "unused"})
@SuppressWarnings({"deprecation", "removal", "unused"})
public static void snippetControlFlow1(boolean b, int i) {
Integer object = new Integer(i);
if (b) {
@@ -148,7 +148,7 @@ public void testControlFlow1() {
test("snippetControlFlow1", true, 1);
}

@SuppressWarnings({"deprecation", "unused"})
@SuppressWarnings({"deprecation", "removal", "unused"})
public static void snippetControlFlow2(boolean b, int i) {
Integer object = new Integer(i);
if (b) {
@@ -165,7 +165,7 @@ public void testControlFlow2() {
test("snippetControlFlow2", true, 1);
}

@SuppressWarnings({"deprecation", "unused"})
@SuppressWarnings({"deprecation", "removal", "unused"})
public static void snippetControlFlow3(boolean b, int i) {
Integer object = new Integer(i);
GraalDirectives.ensureVirtualized(object);
@@ -183,7 +183,7 @@ public void testControlFlow3() {
test("snippetControlFlow3", true, 1);
}

@SuppressWarnings({"deprecation", "unused"})
@SuppressWarnings({"deprecation", "removal", "unused"})
public static void snippetControlFlow4(boolean b, int i) {
Integer object = new Integer(i);
if (b) {
@@ -199,7 +199,7 @@ public void testControlFlow4() {
test("snippetControlFlow4", true, 1);
}

@SuppressWarnings({"deprecation", "unused"})
@SuppressWarnings({"deprecation", "removal", "unused"})
public static void snippetControlFlow5(boolean b, int i) {
Integer object = new Integer(i);
if (b) {
@@ -220,7 +220,7 @@ public static final class TestClass {
Object b;
}

@SuppressWarnings({"deprecation", "unused"})
@SuppressWarnings({"deprecation", "removal", "unused"})
public static void snippetIndirect1(boolean b, int i) {
Integer object = new Integer(i);
TestClass t = new TestClass();
@@ -239,7 +239,7 @@ public void testIndirect1() {
test("snippetIndirect1", true, 1);
}

@SuppressWarnings({"deprecation", "unused"})
@SuppressWarnings({"deprecation", "removal", "unused"})
public static void snippetIndirect2(boolean b, int i) {
Integer object = new Integer(i);
TestClass t = new TestClass();
@@ -115,7 +115,7 @@ public void test3() {
testPartialEscapeAnalysis("test3Snippet", 0.5, 1, StoreFieldNode.class, LoadFieldNode.class);
}

@SuppressWarnings("deprecation")
@SuppressWarnings({"deprecation", "removal"})
public static Object test3Snippet(int a) {
if (a < 0) {
TestObject obj = new TestObject(1, 2);
@@ -114,7 +114,7 @@ public void test02() {
assertEquals(m(sa, B.class, "foo").getFormalReturn(), t(Data.class));
}

@SuppressWarnings({"deprecation", "unused"})
@SuppressWarnings({"deprecation", "removal", "unused"})
static void test03Entry() {
Data data = new Data();
data.f = new Integer(42);
@@ -142,7 +142,7 @@ public void test03() {
assertEquals(m(sa, B.class, "foo").getFormalReturn(), t(Data.class), t(Integer.class));
}

@SuppressWarnings({"deprecation", "unused"})
@SuppressWarnings({"deprecation", "removal", "unused"})
static void test04Entry() {
Data data = null;
for (int i = 0; i < 2; i++) {

0 comments on commit 0c2ef39

Please sign in to comment.