zookeeper-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ph...@apache.org
Subject zookeeper git commit: ZOOKEEPER-2914: compiler warning using java 9
Date Sat, 07 Oct 2017 19:23:54 GMT
Repository: zookeeper
Updated Branches:
  refs/heads/master aa35571ea -> fb10c2b54


ZOOKEEPER-2914: compiler warning using java 9

Replaced deprecated methods (Class.newInstance()) and removed redundant cast

Author: Andor Molnar <andor@cloudera.com>

Reviewers: Patrick Hunt <phunt@apache.org>

Closes #392 from dolphy17/ZOOKEEPER-2914 and squashes the following commits:

ab7bd5e2 [Andor Molnar] Reverted explicit case, because java 1.7 requires it to compile
b2d400bc [Andor Molnar] Replaced Class.newInstance() methods (deprecated in Java 9) with Constructor.newInstance()

Change-Id: Iae00f0874b69d425f35b96775d6ac9634b3ade73


Project: http://git-wip-us.apache.org/repos/asf/zookeeper/repo
Commit: http://git-wip-us.apache.org/repos/asf/zookeeper/commit/fb10c2b5
Tree: http://git-wip-us.apache.org/repos/asf/zookeeper/tree/fb10c2b5
Diff: http://git-wip-us.apache.org/repos/asf/zookeeper/diff/fb10c2b5

Branch: refs/heads/master
Commit: fb10c2b54698c8aab4477670bb0d6f7fe99c5c43
Parents: aa35571
Author: Andor Molnar <andor@cloudera.com>
Authored: Sat Oct 7 12:22:42 2017 -0700
Committer: Patrick Hunt <phunt@apache.org>
Committed: Sat Oct 7 12:22:42 2017 -0700

----------------------------------------------------------------------
 src/java/main/org/apache/zookeeper/jmx/ManagedUtil.java           | 2 +-
 src/java/main/org/apache/zookeeper/server/NIOServerCnxn.java      | 2 +-
 src/java/main/org/apache/zookeeper/server/ServerCnxnFactory.java  | 3 ++-
 .../main/org/apache/zookeeper/server/auth/ProviderRegistry.java   | 2 +-
 4 files changed, 5 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zookeeper/blob/fb10c2b5/src/java/main/org/apache/zookeeper/jmx/ManagedUtil.java
----------------------------------------------------------------------
diff --git a/src/java/main/org/apache/zookeeper/jmx/ManagedUtil.java b/src/java/main/org/apache/zookeeper/jmx/ManagedUtil.java
index 1ce4faa..43451b0 100644
--- a/src/java/main/org/apache/zookeeper/jmx/ManagedUtil.java
+++ b/src/java/main/org/apache/zookeeper/jmx/ManagedUtil.java
@@ -69,7 +69,7 @@ public class ManagedUtil {
             try {
                 // Create and Register the top level Log4J MBean
                 // org.apache.log4j.jmx.HierarchyDynamicMBean hdm = new org.apache.log4j.jmx.HierarchyDynamicMBean();
-                Object hdm = Class.forName("org.apache.log4j.jmx.HierarchyDynamicMBean").newInstance();
+                Object hdm = Class.forName("org.apache.log4j.jmx.HierarchyDynamicMBean").getDeclaredConstructor().newInstance();
 
                 ObjectName mbo = new ObjectName("log4j:hiearchy=default");
                 mbs.registerMBean(hdm, mbo);

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/fb10c2b5/src/java/main/org/apache/zookeeper/server/NIOServerCnxn.java
----------------------------------------------------------------------
diff --git a/src/java/main/org/apache/zookeeper/server/NIOServerCnxn.java b/src/java/main/org/apache/zookeeper/server/NIOServerCnxn.java
index 6dae02d..446438c 100644
--- a/src/java/main/org/apache/zookeeper/server/NIOServerCnxn.java
+++ b/src/java/main/org/apache/zookeeper/server/NIOServerCnxn.java
@@ -252,7 +252,7 @@ public class NIOServerCnxn extends ServerCnxn {
                      * so we've got to slice the buffer if it's too big.
                      */
                     b = (ByteBuffer) b.slice().limit(
-                        directBuffer.remaining());
+                            directBuffer.remaining());
                 }
                 /*
                  * put() is going to modify the positions of both

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/fb10c2b5/src/java/main/org/apache/zookeeper/server/ServerCnxnFactory.java
----------------------------------------------------------------------
diff --git a/src/java/main/org/apache/zookeeper/server/ServerCnxnFactory.java b/src/java/main/org/apache/zookeeper/server/ServerCnxnFactory.java
index 1d2b044..dbe47a2 100644
--- a/src/java/main/org/apache/zookeeper/server/ServerCnxnFactory.java
+++ b/src/java/main/org/apache/zookeeper/server/ServerCnxnFactory.java
@@ -130,7 +130,8 @@ public abstract class ServerCnxnFactory {
             serverCnxnFactoryName = NIOServerCnxnFactory.class.getName();
         }
         try {
-            ServerCnxnFactory serverCnxnFactory = (ServerCnxnFactory) Class.forName(serverCnxnFactoryName).newInstance();
+            ServerCnxnFactory serverCnxnFactory = (ServerCnxnFactory) Class.forName(serverCnxnFactoryName)
+                    .getDeclaredConstructor().newInstance();
             LOG.info("Using {} as server connection factory", serverCnxnFactoryName);
             return serverCnxnFactory;
         } catch (Exception e) {

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/fb10c2b5/src/java/main/org/apache/zookeeper/server/auth/ProviderRegistry.java
----------------------------------------------------------------------
diff --git a/src/java/main/org/apache/zookeeper/server/auth/ProviderRegistry.java b/src/java/main/org/apache/zookeeper/server/auth/ProviderRegistry.java
index c7aa81b..ed69f92 100644
--- a/src/java/main/org/apache/zookeeper/server/auth/ProviderRegistry.java
+++ b/src/java/main/org/apache/zookeeper/server/auth/ProviderRegistry.java
@@ -58,7 +58,7 @@ public class ProviderRegistry {
                     try {
                         Class<?> c = ZooKeeperServer.class.getClassLoader()
                                 .loadClass(className);
-                        AuthenticationProvider ap = (AuthenticationProvider) c
+                        AuthenticationProvider ap = (AuthenticationProvider) c.getDeclaredConstructor()
                                 .newInstance();
                         authenticationProviders.put(ap.getScheme(), ap);
                     } catch (Exception e) {


Mime
View raw message