Avoid calling primitive wrapper constructors in server-spi-private (#24163)

Signed-off-by: Thomas Darimont <thomas.darimont@googlemail.com>
This commit is contained in:
Thomas Darimont 2024-01-11 11:54:44 +01:00 committed by GitHub
parent 0bf1fe3eb3
commit 9d429400d4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 4 deletions

View file

@ -49,7 +49,7 @@ public class DoubleValidator extends AbstractNumberValidator implements Configur
if (value instanceof Number) { if (value instanceof Number) {
return (Number) value; return (Number) value;
} }
return new Double(value.toString()); return Double.valueOf(value.toString());
} }
@Override @Override

View file

@ -44,7 +44,7 @@ public class IntegerValidator extends AbstractNumberValidator implements Configu
if (value instanceof Integer || value instanceof Long) { if (value instanceof Integer || value instanceof Long) {
return (Number) value; return (Number) value;
} }
return new Long(value.toString()); return Long.valueOf(value.toString());
} }
@Override @Override

View file

@ -108,7 +108,7 @@ public class ValidatorConfig {
return ((Number) value).intValue(); return ((Number) value).intValue();
} else if (value instanceof String) { } else if (value instanceof String) {
try { try {
return new Integer((String) value); return Integer.valueOf((String) value);
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
return null; return null;
} }
@ -128,7 +128,7 @@ public class ValidatorConfig {
return ((Number) value).longValue(); return ((Number) value).longValue();
} else if (value instanceof String) { } else if (value instanceof String) {
try { try {
return new Long((String) value); return Long.valueOf((String) value);
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
return null; return null;
} }