You are viewing a plain text version of this content. The canonical link for it is here.
Posted to gitbox@hive.apache.org by "zabetak (via GitHub)" <gi...@apache.org> on 2023/01/26 11:22:21 UTC

[GitHub] [hive] zabetak commented on a diff in pull request #3983: HIVE-26984: Deprecate public HiveConf constructors

zabetak commented on code in PR #3983:
URL: https://github.com/apache/hive/pull/3983#discussion_r1087707504


##########
common/src/java/org/apache/hadoop/hive/conf/HiveConf.java:
##########
@@ -6322,29 +6322,67 @@ public ZooKeeperHiveHelper getZKConfig() {
       .trustStorePassword(trustStorePassword).build();
   }
 
+  public static HiveConf create() {
+    return new HiveConf();
+  }
+
+  public static HiveConf create(Class<?> cls) {
+    return new HiveConf(cls);
+  }
+
+  public static HiveConf create(Configuration other, Class<?> cls) {
+    return new HiveConf(other, cls);
+  }
+
+
+  public static HiveConf create(HiveConf other) {
+    return new HiveConf(other);
+  }
+
+  /**
+   * Instantiating HiveConf is deprecated. Please use
+   * HiveConf#create() to construct a Configuration,
+   * this method will become private eventually.
+   * @deprecated Please use create method instead.
+   */
   public HiveConf() {

Review Comment:
   Please include the `@Deprecated` annotation it is useful for some purposes.
   
   "Instantiating HiveConf is deprecated" phrase is redundant. IDEs and compilers will generate automatically similar warnings when calling this method.
   
   "Instatiating...eventually" the whole paragraph concerns deprecation so it should be associated with the `@deprecated` tag.
   
   Based on [1] and the comments above, I would suggest the following:
   ```java
     /**
      * @deprecated This method will become private eventually; Use {@link #create()} instead. 
      */
     @Deprecated
     public HiveConf() {
   ```
   
   [1] https://docs.oracle.com/javase/7/docs/technotes/guides/javadoc/deprecation/deprecation.html
   



##########
common/src/java/org/apache/hadoop/hive/conf/HiveConf.java:
##########
@@ -6322,29 +6322,67 @@ public ZooKeeperHiveHelper getZKConfig() {
       .trustStorePassword(trustStorePassword).build();
   }
 
+  public static HiveConf create() {
+    return new HiveConf();
+  }
+
+  public static HiveConf create(Class<?> cls) {
+    return new HiveConf(cls);
+  }
+
+  public static HiveConf create(Configuration other, Class<?> cls) {
+    return new HiveConf(other, cls);
+  }
+
+
+  public static HiveConf create(HiveConf other) {
+    return new HiveConf(other);
+  }
+
+  /**
+   * Instantiating HiveConf is deprecated. Please use
+   * HiveConf#create() to construct a Configuration,
+   * this method will become private eventually.

Review Comment:
   If we make those private then we are breaking inheritance which is fine by me but wanted to mention it just in case.
   
   For sanity reasons I would also attempt to run the precommit tests with all the constructors private to see if there are any hidden reflection calls or other exotic usages.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org