IMPALA-11273: Remove APIs deprecated in Java 11

Replaces constructor calls for object versions of primitives - Integer,
Long, Float, Double, Boolean - with optimized valueOf calls as using
constructors for these is deprecated according to jdeprscan.

Removes override of finalize. Use of finalize is deprecated, and
hive-udf-call.cc ensures we always call close when unloading the UDF.
Adds try-with-resources to UdfExecutorTest to handle test cleanup.

Updates BigDecimal.setScale to use RoundingMode.

Change-Id: Idfb053223b6e098e6032502f873361696dd2da84
Reviewed-on: http://gerrit.cloudera.org:8080/19721
Reviewed-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com>
Tested-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com>
This commit is contained in:
Michael Smith
2023-04-10 16:42:23 -07:00
committed by Impala Public Jenkins
parent b73847f178
commit f0289f3cbb
11 changed files with 72 additions and 75 deletions

View File

@@ -237,11 +237,11 @@ public class RandomNestedDataGenerator {
}
return m;
}
case BOOLEAN: return new Boolean(getRandomBoolean());
case DOUBLE: return new Double(getRandomDouble());
case FLOAT: return new Float(getRandomFloat());
case INT: return new Integer(getRandomInt());
case LONG: return new Long(getRandomLong());
case BOOLEAN: return Boolean.valueOf(getRandomBoolean());
case DOUBLE: return Double.valueOf(getRandomDouble());
case FLOAT: return Float.valueOf(getRandomFloat());
case INT: return Integer.valueOf(getRandomInt());
case LONG: return Long.valueOf(getRandomLong());
case STRING: return getRandomString();
// TODO: Decimal
// TODO: Timestamp
@@ -256,8 +256,8 @@ public class RandomNestedDataGenerator {
System.exit(1);
}
String schemaFile = args[0];
int numElements = new Integer(args[1]);
numListItems = new Integer(args[2]);
int numElements = Integer.valueOf(args[1]);
numListItems = Integer.valueOf(args[2]);
String outputFile = args[3];
generateDataToFile(schemaFile, numElements, outputFile);