You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kyuubi.apache.org by ul...@apache.org on 2023/01/17 06:47:13 UTC

[kyuubi] branch master updated: [KYUUBI #4176] Eliminate unhelpful warning messages in Javac output of Java 11

This is an automated email from the ASF dual-hosted git repository.

ulyssesyou pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kyuubi.git


The following commit(s) were added to refs/heads/master by this push:
     new 7b408efa3 [KYUUBI #4176] Eliminate unhelpful warning messages in Javac output of Java 11
7b408efa3 is described below

commit 7b408efa33e86481ab34c63b383f4ac04be6a189
Author: liangbowen <li...@gf.com.cn>
AuthorDate: Tue Jan 17 14:46:59 2023 +0800

    [KYUUBI #4176] Eliminate unhelpful warning messages in Javac output of Java 11
    
    ### _Why are the changes needed?_
    
    As #4166 cleanup unhelpful warning messages in Java 8, this PR does the same to Java 11 deprecation warnings.
    
    - add SuppressWarnings("deprecation") to `HiveDecimal` and `FastHiveDecimalImpl`, eliminating warnings of using the deprecated field of `BigDecimal` since Java 9 in Java 11, e.g. (40 warnings in a build)
    
    ```
    Warning:  /home/runner/work/kyuubi/kyuubi/kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/common/HiveDecimal.java:[133,50] [deprecation] ROUND_FLOOR in BigDecimal has been deprecated
    Warning:  /home/runner/work/kyuubi/kyuubi/kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/common/HiveDecimal.java:[150,52] [deprecation] ROUND_CEILING in BigDecimal has been deprecated
    Warning:  /home/runner/work/kyuubi/kyuubi/kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/common/HiveDecimal.java:[165,52] [deprecation] ROUND_HALF_UP in BigDecimal has been deprecated
    Warning:  /home/runner/work/kyuubi/kyuubi/kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/common/HiveDecimal.java:[186,54] [deprecation] ROUND_HALF_EVEN in BigDecimal has been deprecated
    Warning:  /home/runner/work/kyuubi/kyuubi/kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/common/FastHiveDecimalImpl.java:[2934,20] [deprecation] ROUND_HALF_UP in BigDecimal has been deprecated
    Warning:  /home/runner/work/kyuubi/kyuubi/kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/common/FastHiveDecimalImpl.java:[4411,23] [deprecation] ROUND_DOWN in BigDecimal has been deprecated
    Warning:  /home/runner/work/kyuubi/kyuubi/kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/common/FastHiveDecimalImpl.java:[4424,23] [deprecation] ROUND_UP in BigDecimal has been deprecated
    ```
    
    - fix `rawtypes` usages and redundant boxing in `KyuubiCommands`
    ```
    Warning:  /home/runner/work/kyuubi/kyuubi/kyuubi-hive-beeline/src/main/java/org/apache/hive/beeline/KyuubiCommands.java:408:9:  [rawtypes] found raw type: Iterator
    Warning:  /home/runner/work/kyuubi/kyuubi/kyuubi-hive-beeline/src/main/java/org/apache/hive/beeline/KyuubiCommands.java:[475,71] [deprecation] Character(char) in Character has been deprecated
    ```
    
    - add SuppressWarnings("deprecation") to `KyuubiBeeLine.java` for using deprecated `Class#newInstance` of Java 11
    
    ```
    Warning:  /home/runner/work/kyuubi/kyuubi/kyuubi-hive-beeline/src/main/java/org/apache/hive/beeline/KyuubiBeeLine.java:[59,18] [deprecation] newInstance() in Class has been deprecated
      where T is a type-variable:
        T extends Object declared in class Class
    Warning:  /home/runner/work/kyuubi/kyuubi/kyuubi-hive-beeline/src/main/java/org/apache/hive/beeline/KyuubiBeeLine.java:59:18:  [deprecation] newInstance() in Class has been deprecated
    Warning:  /home/runner/work/kyuubi/kyuubi/kyuubi-hive-beeline/src/main/java/org/apache/hive/beeline/KyuubiCommands.java:475:71:  [deprecation] Character(char) in Character has been deprecated
    ```
    
    ### _How was this patch tested?_
    - [ ] Add some test cases that check the changes thoroughly including negative and positive cases if possible
    
    - [ ] Add screenshots for manual tests if appropriate
    
    - [x] [Run test](https://kyuubi.readthedocs.io/en/master/develop_tools/testing.html#running-tests) locally before make a pull request
    
    Closes #4176 from bowenliang123/java11-warnings.
    
    Closes #4176
    
    d0c0640f [liangbowen] style
    b26679ea [liangbowen] add @SuppressWarnings("deprecation") to HiveDecimal and FastHiveDecimalImpl and constructor of KyuubiBeeLine, remove unnecessary boxing of char in KyuubiCommands#connect, fix raw types usage in KyuubiCommands#getProperty
    
    Authored-by: liangbowen <li...@gf.com.cn>
    Signed-off-by: ulysses-you <ul...@apache.org>
---
 .../src/main/java/org/apache/hive/beeline/KyuubiBeeLine.java        | 1 +
 .../src/main/java/org/apache/hive/beeline/KyuubiCommands.java       | 6 ++----
 .../org/apache/kyuubi/jdbc/hive/common/FastHiveDecimalImpl.java     | 1 +
 .../main/java/org/apache/kyuubi/jdbc/hive/common/HiveDecimal.java   | 1 +
 4 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/kyuubi-hive-beeline/src/main/java/org/apache/hive/beeline/KyuubiBeeLine.java b/kyuubi-hive-beeline/src/main/java/org/apache/hive/beeline/KyuubiBeeLine.java
index c88ceb5a8..7ca767148 100644
--- a/kyuubi-hive-beeline/src/main/java/org/apache/hive/beeline/KyuubiBeeLine.java
+++ b/kyuubi-hive-beeline/src/main/java/org/apache/hive/beeline/KyuubiBeeLine.java
@@ -40,6 +40,7 @@ public class KyuubiBeeLine extends BeeLine {
     this(true);
   }
 
+  @SuppressWarnings("deprecation")
   public KyuubiBeeLine(boolean isBeeLine) {
     super(isBeeLine);
     try {
diff --git a/kyuubi-hive-beeline/src/main/java/org/apache/hive/beeline/KyuubiCommands.java b/kyuubi-hive-beeline/src/main/java/org/apache/hive/beeline/KyuubiCommands.java
index 572417847..aaa32739a 100644
--- a/kyuubi-hive-beeline/src/main/java/org/apache/hive/beeline/KyuubiCommands.java
+++ b/kyuubi-hive-beeline/src/main/java/org/apache/hive/beeline/KyuubiCommands.java
@@ -405,7 +405,7 @@ public class KyuubiCommands extends Commands {
       }
     }
 
-    for (Iterator i = props.keySet().iterator(); i.hasNext(); ) {
+    for (Iterator<Object> i = props.keySet().iterator(); i.hasNext(); ) {
       String key = (String) i.next();
       for (int j = 0; j < keys.length; j++) {
         if (key.endsWith(keys[j])) {
@@ -470,9 +470,7 @@ public class KyuubiCommands extends Commands {
       props.setProperty(AUTH_USER, username);
       if (password == null) {
         password =
-            beeLine
-                .getConsoleReader()
-                .readLine("Enter password for " + urlForPrompt + ": ", new Character('*'));
+            beeLine.getConsoleReader().readLine("Enter password for " + urlForPrompt + ": ", '*');
       }
       props.setProperty(AUTH_PASSWD, password);
     }
diff --git a/kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/common/FastHiveDecimalImpl.java b/kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/common/FastHiveDecimalImpl.java
index 50c7daa8b..d3dba0f7b 100644
--- a/kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/common/FastHiveDecimalImpl.java
+++ b/kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/common/FastHiveDecimalImpl.java
@@ -32,6 +32,7 @@ import java.util.Arrays;
  * vectorization to implement decimals by storing the fast0, fast1, and fast2 longs and the
  * fastSignum, fastScale, etc ints in the DecimalColumnVector class.
  */
+@SuppressWarnings("deprecation")
 public class FastHiveDecimalImpl extends FastHiveDecimal {
 
   /**
diff --git a/kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/common/HiveDecimal.java b/kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/common/HiveDecimal.java
index bd4906ec7..b8faa2305 100644
--- a/kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/common/HiveDecimal.java
+++ b/kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/common/HiveDecimal.java
@@ -80,6 +80,7 @@ import java.util.Arrays;
  * <p>The original V1 public methods and fields are annotated with @HiveDecimalVersionV1; new public
  * methods and fields are annotated with @HiveDecimalVersionV2.
  */
+@SuppressWarnings("deprecation")
 public final class HiveDecimal extends FastHiveDecimal implements Comparable<HiveDecimal> {
 
   /*