accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmar...@apache.org
Subject [accumulo] branch master updated: Replace use of deprecated newInstance calls.
Date Tue, 11 Jun 2019 15:02:26 GMT
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
     new bbee47b  Replace use of deprecated newInstance calls.
bbee47b is described below

commit bbee47b8b95d230ba9def235917013dcfeaf7c38
Author: Mark Owens <jmark99@apache.org>
AuthorDate: Mon Jun 10 15:44:32 2019 -0400

    Replace use of deprecated newInstance calls.
    
    Calls to newInstance() are deprecated in JDK 9+. Replace with calls to
    getDeclaredConstructor().newInstance()
---
 .../core/client/security/tokens/AuthenticationToken.java    |  2 +-
 .../org/apache/accumulo/core/conf/ConfigSanityCheck.java    |  3 +--
 .../apache/accumulo/core/conf/ConfigurationTypeHelper.java  |  7 +++----
 .../accumulo/core/conf/CredentialProviderFactoryShim.java   |  5 +++--
 .../java/org/apache/accumulo/core/conf/IterConfigUtil.java  |  4 ++--
 .../apache/accumulo/core/crypto/CryptoServiceFactory.java   |  4 ++--
 .../org/apache/accumulo/core/file/BloomFilterLayer.java     |  9 +++------
 .../file/blockfile/cache/impl/BlockCacheManagerFactory.java |  4 ++--
 .../java/org/apache/accumulo/core/iterators/Combiner.java   |  2 +-
 .../java/org/apache/accumulo/core/iterators/Filter.java     |  2 +-
 .../apache/accumulo/core/iterators/TypedValueCombiner.java  |  4 ++--
 .../accumulo/core/iterators/conf/ColumnToClassMapping.java  |  7 +++----
 .../accumulo/core/iterators/user/RowEncodingIterator.java   |  2 +-
 .../org/apache/accumulo/core/iterators/user/RowFilter.java  |  2 +-
 .../apache/accumulo/core/iterators/user/SeekingFilter.java  |  2 +-
 .../accumulo/core/iterators/user/TransformingIterator.java  |  2 +-
 .../apache/accumulo/core/sample/impl/SamplerFactory.java    |  4 ++--
 .../org/apache/accumulo/core/summary/SummarizerFactory.java | 13 +++++++------
 .../java/org/apache/accumulo/core/util/CreateToken.java     |  7 +++----
 .../apache/accumulo/core/util/format/FormatterFactory.java  |  2 +-
 .../java/org/apache/accumulo/core/crypto/CryptoTest.java    |  5 ++---
 .../apache/accumulo/core/iterators/user/CombinerTest.java   |  7 +++----
 .../apache/accumulo/core/iterators/user/TestCfCqSlice.java  |  6 ++++--
 .../core/iterators/user/TransformingIteratorTest.java       |  6 +++---
 .../accumulo/iteratortest/IteratorTestCaseFinder.java       |  4 ++--
 .../org/apache/accumulo/iteratortest/IteratorTestUtil.java  |  4 ++--
 .../iteratortest/testcases/InstantiationTestCase.java       |  2 +-
 .../org/apache/accumulo/server/ServiceEnvironmentImpl.java  |  4 ++--
 .../apache/accumulo/server/client/ClientServiceHandler.java |  9 ++++-----
 .../accumulo/server/replication/ReplicaSystemFactory.java   |  4 ++--
 .../java/org/apache/accumulo/server/util/DefaultMap.java    |  2 +-
 .../org/apache/accumulo/server/util/LoginProperties.java    |  5 +++--
 .../org/apache/accumulo/master/replication/WorkDriver.java  |  4 ++--
 .../main/java/org/apache/accumulo/tracer/TraceServer.java   |  5 ++---
 .../accumulo/tserver/constraints/ConstraintChecker.java     |  2 +-
 .../tserver/replication/ReplicationServicerHandler.java     |  4 ++--
 .../java/org/apache/accumulo/tserver/tablet/Tablet.java     |  2 +-
 .../org/apache/accumulo/shell/commands/ScanCommand.java     |  2 +-
 .../org/apache/accumulo/shell/commands/SetIterCommand.java  |  6 ++----
 start/src/main/java/org/apache/accumulo/start/Main.java     |  5 ++---
 .../vfs/AccumuloReloadingVFSClassLoaderTest.java            |  8 ++++----
 .../start/classloader/vfs/AccumuloVFSClassLoaderTest.java   |  2 +-
 .../accumulo/start/classloader/vfs/ContextManagerTest.java  |  4 ++--
 .../start/classloader/vfs/providers/VfsClassLoaderTest.java |  2 +-
 .../java/org/apache/accumulo/test/BatchWriterIterator.java  |  2 +-
 .../java/org/apache/accumulo/test/HardListIterator.java     |  2 +-
 .../org/apache/accumulo/test/util/SerializationUtil.java    |  4 ++--
 47 files changed, 95 insertions(+), 104 deletions(-)

diff --git a/core/src/main/java/org/apache/accumulo/core/client/security/tokens/AuthenticationToken.java b/core/src/main/java/org/apache/accumulo/core/client/security/tokens/AuthenticationToken.java
index 12aade5..4de7ac7 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/security/tokens/AuthenticationToken.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/security/tokens/AuthenticationToken.java
@@ -63,7 +63,7 @@ public interface AuthenticationToken extends Writable, Destroyable, Cloneable {
         byte[] tokenBytes) {
       T type = null;
       try {
-        type = tokenType.newInstance();
+        type = tokenType.getDeclaredConstructor().newInstance();
       } catch (Exception e) {
         throw new IllegalArgumentException("Cannot instantiate " + tokenType.getName(), e);
       }
diff --git a/core/src/main/java/org/apache/accumulo/core/conf/ConfigSanityCheck.java b/core/src/main/java/org/apache/accumulo/core/conf/ConfigSanityCheck.java
index e606057..a0d6fa8 100644
--- a/core/src/main/java/org/apache/accumulo/core/conf/ConfigSanityCheck.java
+++ b/core/src/main/java/org/apache/accumulo/core/conf/ConfigSanityCheck.java
@@ -158,8 +158,7 @@ public class ConfigSanityCheck {
       Class<?> requiredBaseClass) {
     try {
       ConfigurationTypeHelper.getClassInstance(null, className, requiredBaseClass);
-    } catch (ClassNotFoundException | InstantiationException | IllegalAccessException
-        | IOException e) {
+    } catch (IOException | ReflectiveOperationException e) {
       fatal(confOption + " has an invalid class name: " + className);
     } catch (ClassCastException e) {
       fatal(confOption + " must implement " + requiredBaseClass
diff --git a/core/src/main/java/org/apache/accumulo/core/conf/ConfigurationTypeHelper.java b/core/src/main/java/org/apache/accumulo/core/conf/ConfigurationTypeHelper.java
index b4686ed..4ad8b19 100644
--- a/core/src/main/java/org/apache/accumulo/core/conf/ConfigurationTypeHelper.java
+++ b/core/src/main/java/org/apache/accumulo/core/conf/ConfigurationTypeHelper.java
@@ -172,8 +172,7 @@ public class ConfigurationTypeHelper {
 
     try {
       instance = getClassInstance(context, clazzName, base);
-    } catch (RuntimeException | ClassNotFoundException | IOException | InstantiationException
-        | IllegalAccessException e) {
+    } catch (RuntimeException | IOException | ReflectiveOperationException e) {
       log.warn("Failed to load class {}", clazzName, e);
     }
 
@@ -196,7 +195,7 @@ public class ConfigurationTypeHelper {
    * @return a new instance of the class
    */
   public static <T> T getClassInstance(String context, String clazzName, Class<T> base)
-      throws ClassNotFoundException, IOException, InstantiationException, IllegalAccessException {
+      throws IOException, ReflectiveOperationException {
     T instance;
 
     Class<? extends T> clazz;
@@ -206,7 +205,7 @@ public class ConfigurationTypeHelper {
       clazz = AccumuloVFSClassLoader.loadClass(clazzName, base);
     }
 
-    instance = clazz.newInstance();
+    instance = clazz.getDeclaredConstructor().newInstance();
     if (loaded.put(clazzName, clazz) != clazz)
       log.debug("Loaded class : {}", clazzName);
 
diff --git a/core/src/main/java/org/apache/accumulo/core/conf/CredentialProviderFactoryShim.java b/core/src/main/java/org/apache/accumulo/core/conf/CredentialProviderFactoryShim.java
index 36374eb..a029a2c 100644
--- a/core/src/main/java/org/apache/accumulo/core/conf/CredentialProviderFactoryShim.java
+++ b/core/src/main/java/org/apache/accumulo/core/conf/CredentialProviderFactoryShim.java
@@ -115,8 +115,9 @@ public class CredentialProviderFactoryShim {
 
     // Instantiate Hadoop CredentialProviderFactory
     try {
-      hadoopCredProviderFactory = hadoopCredProviderFactoryClz.newInstance();
-    } catch (InstantiationException | IllegalAccessException e) {
+      hadoopCredProviderFactory =
+          hadoopCredProviderFactoryClz.getDeclaredConstructor().newInstance();
+    } catch (ReflectiveOperationException e) {
       log.trace("Could not instantiate class {}", HADOOP_CRED_PROVIDER_FACTORY_CLASS_NAME, e);
       return false;
     }
diff --git a/core/src/main/java/org/apache/accumulo/core/conf/IterConfigUtil.java b/core/src/main/java/org/apache/accumulo/core/conf/IterConfigUtil.java
index 7a2d341..c8b0004 100644
--- a/core/src/main/java/org/apache/accumulo/core/conf/IterConfigUtil.java
+++ b/core/src/main/java/org/apache/accumulo/core/conf/IterConfigUtil.java
@@ -217,7 +217,7 @@ public class IterConfigUtil {
           clazz = loadClass(iterLoad.useAccumuloClassLoader, iterLoad.context, iterInfo);
         }
 
-        SortedKeyValueIterator<Key,Value> skvi = clazz.newInstance();
+        SortedKeyValueIterator<Key,Value> skvi = clazz.getDeclaredConstructor().newInstance();
 
         Map<String,String> options = iterLoad.iterOpts.get(iterInfo.iterName);
 
@@ -227,7 +227,7 @@ public class IterConfigUtil {
         skvi.init(prev, options, iterLoad.iteratorEnvironment);
         prev = skvi;
       }
-    } catch (ClassNotFoundException | IllegalAccessException | InstantiationException e) {
+    } catch (ReflectiveOperationException e) {
       log.error(e.toString());
       throw new RuntimeException(e);
     }
diff --git a/core/src/main/java/org/apache/accumulo/core/crypto/CryptoServiceFactory.java b/core/src/main/java/org/apache/accumulo/core/crypto/CryptoServiceFactory.java
index aefacaf..ad7c899 100644
--- a/core/src/main/java/org/apache/accumulo/core/crypto/CryptoServiceFactory.java
+++ b/core/src/main/java/org/apache/accumulo/core/crypto/CryptoServiceFactory.java
@@ -45,8 +45,8 @@ public class CryptoServiceFactory {
       } else {
         try {
           newCryptoService = CryptoServiceFactory.class.getClassLoader().loadClass(clazzName)
-              .asSubclass(CryptoService.class).newInstance();
-        } catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) {
+              .asSubclass(CryptoService.class).getDeclaredConstructor().newInstance();
+        } catch (ReflectiveOperationException e) {
           throw new RuntimeException(e);
         }
       }
diff --git a/core/src/main/java/org/apache/accumulo/core/file/BloomFilterLayer.java b/core/src/main/java/org/apache/accumulo/core/file/BloomFilterLayer.java
index 177c628..6e150e5 100644
--- a/core/src/main/java/org/apache/accumulo/core/file/BloomFilterLayer.java
+++ b/core/src/main/java/org/apache/accumulo/core/file/BloomFilterLayer.java
@@ -134,7 +134,7 @@ public class BloomFilterLayer {
         else
           clazz = AccumuloVFSClassLoader.loadClass(classname, KeyFunctor.class);
 
-        transformer = clazz.newInstance();
+        transformer = clazz.getDeclaredConstructor().newInstance();
 
       } catch (Exception e) {
         LOG.error("Failed to find KeyFunctor: " + acuconf.get(Property.TABLE_BLOOM_KEY_FUNCTOR), e);
@@ -245,7 +245,7 @@ public class BloomFilterLayer {
                 KeyFunctor.class);
           else
             clazz = AccumuloVFSClassLoader.loadClass(ClassName, KeyFunctor.class);
-          transformer = clazz.newInstance();
+          transformer = clazz.getDeclaredConstructor().newInstance();
 
           /**
            * read in bloom filter
@@ -266,12 +266,9 @@ public class BloomFilterLayer {
         } catch (ClassNotFoundException e) {
           LOG.error("Failed to find KeyFunctor in config: " + sanitize(ClassName), e);
           bloomFilter = null;
-        } catch (InstantiationException e) {
+        } catch (ReflectiveOperationException e) {
           LOG.error("Could not instantiate KeyFunctor: " + sanitize(ClassName), e);
           bloomFilter = null;
-        } catch (IllegalAccessException e) {
-          LOG.error("Illegal acess exception", e);
-          bloomFilter = null;
         } catch (RuntimeException rte) {
           if (!closed)
             throw rte;
diff --git a/core/src/main/java/org/apache/accumulo/core/file/blockfile/cache/impl/BlockCacheManagerFactory.java b/core/src/main/java/org/apache/accumulo/core/file/blockfile/cache/impl/BlockCacheManagerFactory.java
index c146656..292bd20 100644
--- a/core/src/main/java/org/apache/accumulo/core/file/blockfile/cache/impl/BlockCacheManagerFactory.java
+++ b/core/src/main/java/org/apache/accumulo/core/file/blockfile/cache/impl/BlockCacheManagerFactory.java
@@ -44,7 +44,7 @@ public class BlockCacheManagerFactory {
     Class<? extends BlockCacheManager> clazz =
         AccumuloVFSClassLoader.loadClass(impl, BlockCacheManager.class);
     LOG.info("Created new block cache manager of type: {}", clazz.getSimpleName());
-    return clazz.newInstance();
+    return clazz.getDeclaredConstructor().newInstance();
   }
 
   /**
@@ -62,6 +62,6 @@ public class BlockCacheManagerFactory {
     Class<? extends BlockCacheManager> clazz =
         Class.forName(impl).asSubclass(BlockCacheManager.class);
     LOG.info("Created new block cache factory of type: {}", clazz.getSimpleName());
-    return clazz.newInstance();
+    return clazz.getDeclaredConstructor().newInstance();
   }
 }
diff --git a/core/src/main/java/org/apache/accumulo/core/iterators/Combiner.java b/core/src/main/java/org/apache/accumulo/core/iterators/Combiner.java
index 4babca8..82c86d2 100644
--- a/core/src/main/java/org/apache/accumulo/core/iterators/Combiner.java
+++ b/core/src/main/java/org/apache/accumulo/core/iterators/Combiner.java
@@ -310,7 +310,7 @@ public abstract class Combiner extends WrappingIterator implements OptionDescrib
     // TODO test
     Combiner newInstance;
     try {
-      newInstance = this.getClass().newInstance();
+      newInstance = this.getClass().getDeclaredConstructor().newInstance();
     } catch (Exception e) {
       throw new RuntimeException(e);
     }
diff --git a/core/src/main/java/org/apache/accumulo/core/iterators/Filter.java b/core/src/main/java/org/apache/accumulo/core/iterators/Filter.java
index 8c39fef..a123397 100644
--- a/core/src/main/java/org/apache/accumulo/core/iterators/Filter.java
+++ b/core/src/main/java/org/apache/accumulo/core/iterators/Filter.java
@@ -42,7 +42,7 @@ public abstract class Filter extends WrappingIterator implements OptionDescriber
   public SortedKeyValueIterator<Key,Value> deepCopy(IteratorEnvironment env) {
     Filter newInstance;
     try {
-      newInstance = this.getClass().newInstance();
+      newInstance = this.getClass().getDeclaredConstructor().newInstance();
     } catch (Exception e) {
       throw new RuntimeException(e);
     }
diff --git a/core/src/main/java/org/apache/accumulo/core/iterators/TypedValueCombiner.java b/core/src/main/java/org/apache/accumulo/core/iterators/TypedValueCombiner.java
index 6d0df5a..7538ed8 100644
--- a/core/src/main/java/org/apache/accumulo/core/iterators/TypedValueCombiner.java
+++ b/core/src/main/java/org/apache/accumulo/core/iterators/TypedValueCombiner.java
@@ -137,8 +137,8 @@ public abstract class TypedValueCombiner<V> extends Combiner {
       @SuppressWarnings("unchecked")
       Class<? extends Encoder<V>> clazz = (Class<? extends Encoder<V>>) AccumuloVFSClassLoader
           .loadClass(encoderClass, Encoder.class);
-      encoder = clazz.newInstance();
-    } catch (ClassNotFoundException | IllegalAccessException | InstantiationException e) {
+      encoder = clazz.getDeclaredConstructor().newInstance();
+    } catch (ReflectiveOperationException e) {
       throw new IllegalArgumentException(e);
     }
   }
diff --git a/core/src/main/java/org/apache/accumulo/core/iterators/conf/ColumnToClassMapping.java b/core/src/main/java/org/apache/accumulo/core/iterators/conf/ColumnToClassMapping.java
index 979d507..2d80fdd 100644
--- a/core/src/main/java/org/apache/accumulo/core/iterators/conf/ColumnToClassMapping.java
+++ b/core/src/main/java/org/apache/accumulo/core/iterators/conf/ColumnToClassMapping.java
@@ -42,13 +42,12 @@ public class ColumnToClassMapping<K> {
   }
 
   public ColumnToClassMapping(Map<String,String> objectStrings, Class<? extends K> c)
-      throws InstantiationException, IllegalAccessException, ClassNotFoundException, IOException {
+      throws ReflectiveOperationException, IOException {
     this(objectStrings, c, null);
   }
 
   public ColumnToClassMapping(Map<String,String> objectStrings, Class<? extends K> c,
-      String context)
-      throws InstantiationException, IllegalAccessException, ClassNotFoundException, IOException {
+      String context) throws ReflectiveOperationException, IOException {
     this();
 
     for (Entry<String,String> entry : objectStrings.entrySet()) {
@@ -65,7 +64,7 @@ public class ColumnToClassMapping<K> {
         clazz = AccumuloVFSClassLoader.loadClass(className, c);
 
       @SuppressWarnings("unchecked")
-      K inst = (K) clazz.newInstance();
+      K inst = (K) clazz.getDeclaredConstructor().newInstance();
       if (pcic.getSecond() == null) {
         addObject(pcic.getFirst(), inst);
       } else {
diff --git a/core/src/main/java/org/apache/accumulo/core/iterators/user/RowEncodingIterator.java b/core/src/main/java/org/apache/accumulo/core/iterators/user/RowEncodingIterator.java
index c693ba8..a9d902e 100644
--- a/core/src/main/java/org/apache/accumulo/core/iterators/user/RowEncodingIterator.java
+++ b/core/src/main/java/org/apache/accumulo/core/iterators/user/RowEncodingIterator.java
@@ -87,7 +87,7 @@ public abstract class RowEncodingIterator
   public SortedKeyValueIterator<Key,Value> deepCopy(IteratorEnvironment env) {
     RowEncodingIterator newInstance;
     try {
-      newInstance = this.getClass().newInstance();
+      newInstance = this.getClass().getDeclaredConstructor().newInstance();
     } catch (Exception e) {
       throw new RuntimeException(e);
     }
diff --git a/core/src/main/java/org/apache/accumulo/core/iterators/user/RowFilter.java b/core/src/main/java/org/apache/accumulo/core/iterators/user/RowFilter.java
index 67a20db..f1d5e1e 100644
--- a/core/src/main/java/org/apache/accumulo/core/iterators/user/RowFilter.java
+++ b/core/src/main/java/org/apache/accumulo/core/iterators/user/RowFilter.java
@@ -151,7 +151,7 @@ public abstract class RowFilter extends WrappingIterator {
   public SortedKeyValueIterator<Key,Value> deepCopy(IteratorEnvironment env) {
     RowFilter newInstance;
     try {
-      newInstance = getClass().newInstance();
+      newInstance = getClass().getDeclaredConstructor().newInstance();
     } catch (Exception e) {
       throw new RuntimeException(e);
     }
diff --git a/core/src/main/java/org/apache/accumulo/core/iterators/user/SeekingFilter.java b/core/src/main/java/org/apache/accumulo/core/iterators/user/SeekingFilter.java
index 00c27a4..fc31aaf 100644
--- a/core/src/main/java/org/apache/accumulo/core/iterators/user/SeekingFilter.java
+++ b/core/src/main/java/org/apache/accumulo/core/iterators/user/SeekingFilter.java
@@ -153,7 +153,7 @@ public abstract class SeekingFilter extends WrappingIterator {
   public SortedKeyValueIterator<Key,Value> deepCopy(IteratorEnvironment env) {
     SeekingFilter newInstance;
     try {
-      newInstance = this.getClass().newInstance();
+      newInstance = this.getClass().getDeclaredConstructor().newInstance();
     } catch (Exception e) {
       throw new RuntimeException(e);
     }
diff --git a/core/src/main/java/org/apache/accumulo/core/iterators/user/TransformingIterator.java b/core/src/main/java/org/apache/accumulo/core/iterators/user/TransformingIterator.java
index bc5ef88..e3eeb94 100644
--- a/core/src/main/java/org/apache/accumulo/core/iterators/user/TransformingIterator.java
+++ b/core/src/main/java/org/apache/accumulo/core/iterators/user/TransformingIterator.java
@@ -175,7 +175,7 @@ public abstract class TransformingIterator extends WrappingIterator implements O
     TransformingIterator copy;
 
     try {
-      copy = getClass().newInstance();
+      copy = getClass().getDeclaredConstructor().newInstance();
     } catch (Exception e) {
       throw new RuntimeException(e);
     }
diff --git a/core/src/main/java/org/apache/accumulo/core/sample/impl/SamplerFactory.java b/core/src/main/java/org/apache/accumulo/core/sample/impl/SamplerFactory.java
index 0d741a6..42c390d 100644
--- a/core/src/main/java/org/apache/accumulo/core/sample/impl/SamplerFactory.java
+++ b/core/src/main/java/org/apache/accumulo/core/sample/impl/SamplerFactory.java
@@ -40,13 +40,13 @@ public class SamplerFactory {
       else
         clazz = AccumuloVFSClassLoader.loadClass(config.getClassName(), Sampler.class);
 
-      Sampler sampler = clazz.newInstance();
+      Sampler sampler = clazz.getDeclaredConstructor().newInstance();
 
       sampler.init(config.toSamplerConfiguration());
 
       return sampler;
 
-    } catch (ClassNotFoundException | InstantiationException | IllegalAccessException e) {
+    } catch (ReflectiveOperationException e) {
       throw new RuntimeException(e);
     }
   }
diff --git a/core/src/main/java/org/apache/accumulo/core/summary/SummarizerFactory.java b/core/src/main/java/org/apache/accumulo/core/summary/SummarizerFactory.java
index 09cb583..f226ef4 100644
--- a/core/src/main/java/org/apache/accumulo/core/summary/SummarizerFactory.java
+++ b/core/src/main/java/org/apache/accumulo/core/summary/SummarizerFactory.java
@@ -42,23 +42,24 @@ public class SummarizerFactory {
   }
 
   private Summarizer newSummarizer(String classname)
-      throws ClassNotFoundException, IOException, InstantiationException, IllegalAccessException {
+      throws IOException, ReflectiveOperationException {
     if (classloader != null) {
-      return classloader.loadClass(classname).asSubclass(Summarizer.class).newInstance();
+      return classloader.loadClass(classname).asSubclass(Summarizer.class).getDeclaredConstructor()
+          .newInstance();
     } else {
       if (context != null && !context.equals(""))
         return AccumuloVFSClassLoader.getContextManager()
-            .loadClass(context, classname, Summarizer.class).newInstance();
+            .loadClass(context, classname, Summarizer.class).getDeclaredConstructor().newInstance();
       else
-        return AccumuloVFSClassLoader.loadClass(classname, Summarizer.class).newInstance();
+        return AccumuloVFSClassLoader.loadClass(classname, Summarizer.class)
+            .getDeclaredConstructor().newInstance();
     }
   }
 
   public Summarizer getSummarizer(SummarizerConfiguration conf) {
     try {
       return newSummarizer(conf.getClassName());
-    } catch (ClassNotFoundException | InstantiationException | IllegalAccessException
-        | IOException e) {
+    } catch (ReflectiveOperationException | IOException e) {
       throw new RuntimeException(e);
     }
   }
diff --git a/core/src/main/java/org/apache/accumulo/core/util/CreateToken.java b/core/src/main/java/org/apache/accumulo/core/util/CreateToken.java
index 27c4b70..3c9c191 100644
--- a/core/src/main/java/org/apache/accumulo/core/util/CreateToken.java
+++ b/core/src/main/java/org/apache/accumulo/core/util/CreateToken.java
@@ -91,8 +91,8 @@ public class CreateToken implements KeywordExecutable {
         principal = getConsoleReader().readLine("Username (aka principal): ");
       }
 
-      AuthenticationToken token =
-          Class.forName(opts.tokenClassName).asSubclass(AuthenticationToken.class).newInstance();
+      AuthenticationToken token = Class.forName(opts.tokenClassName)
+          .asSubclass(AuthenticationToken.class).getDeclaredConstructor().newInstance();
       Properties props = new Properties();
       for (TokenProperty tp : token.getProperties()) {
         String input;
@@ -111,8 +111,7 @@ public class CreateToken implements KeywordExecutable {
       System.out.println("auth.type = " + opts.tokenClassName);
       System.out.println("auth.principal = " + principal);
       System.out.println("auth.token = " + ClientProperty.encodeToken(token));
-    } catch (IOException | InstantiationException | IllegalAccessException
-        | ClassNotFoundException e) {
+    } catch (IOException | ReflectiveOperationException e) {
       throw new RuntimeException(e);
     }
   }
diff --git a/core/src/main/java/org/apache/accumulo/core/util/format/FormatterFactory.java b/core/src/main/java/org/apache/accumulo/core/util/format/FormatterFactory.java
index fa1542d..184298b 100644
--- a/core/src/main/java/org/apache/accumulo/core/util/format/FormatterFactory.java
+++ b/core/src/main/java/org/apache/accumulo/core/util/format/FormatterFactory.java
@@ -30,7 +30,7 @@ public class FormatterFactory {
       Iterable<Entry<Key,Value>> scanner, FormatterConfig config) {
     Formatter formatter = null;
     try {
-      formatter = formatterClass.newInstance();
+      formatter = formatterClass.getDeclaredConstructor().newInstance();
     } catch (Exception e) {
       log.warn("Unable to instantiate formatter. Using default formatter.", e);
       formatter = new DefaultFormatter();
diff --git a/core/src/test/java/org/apache/accumulo/core/crypto/CryptoTest.java b/core/src/test/java/org/apache/accumulo/core/crypto/CryptoTest.java
index 376fd86..91dbe98 100644
--- a/core/src/test/java/org/apache/accumulo/core/crypto/CryptoTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/crypto/CryptoTest.java
@@ -265,8 +265,7 @@ public class CryptoTest {
   }
 
   @Test
-  public void testMissingConfigProperties()
-      throws ClassNotFoundException, InstantiationException, IllegalAccessException {
+  public void testMissingConfigProperties() throws ReflectiveOperationException {
     ConfigurationCopy aconf = new ConfigurationCopy(DefaultConfiguration.getInstance());
     Configuration conf = new Configuration(false);
     for (Map.Entry<String,String> e : conf) {
@@ -277,7 +276,7 @@ public class CryptoTest {
     String configuredClass = aconf.get(Property.INSTANCE_CRYPTO_SERVICE.getKey());
     Class<? extends CryptoService> clazz =
         AccumuloVFSClassLoader.loadClass(configuredClass, CryptoService.class);
-    CryptoService cs = clazz.newInstance();
+    CryptoService cs = clazz.getDeclaredConstructor().newInstance();
 
     exception.expect(NullPointerException.class);
     cs.init(aconf.getAllPropertiesWithPrefix(Property.TABLE_PREFIX));
diff --git a/core/src/test/java/org/apache/accumulo/core/iterators/user/CombinerTest.java b/core/src/test/java/org/apache/accumulo/core/iterators/user/CombinerTest.java
index 0d83bf0..7b62a4e 100644
--- a/core/src/test/java/org/apache/accumulo/core/iterators/user/CombinerTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/iterators/user/CombinerTest.java
@@ -694,9 +694,8 @@ public class CombinerTest {
   }
 
   public static void sumArray(Class<? extends Encoder<List<Long>>> encoderClass,
-      SummingArrayCombiner.Type type)
-      throws IOException, InstantiationException, IllegalAccessException {
-    Encoder<List<Long>> encoder = encoderClass.newInstance();
+      SummingArrayCombiner.Type type) throws IOException, ReflectiveOperationException {
+    Encoder<List<Long>> encoder = encoderClass.getDeclaredConstructor().newInstance();
 
     TreeMap<Key,Value> tm1 = new TreeMap<>();
 
@@ -789,7 +788,7 @@ public class CombinerTest {
   }
 
   @Test
-  public void sumArrayTest() throws IOException, InstantiationException, IllegalAccessException {
+  public void sumArrayTest() throws IOException, ReflectiveOperationException {
     sumArray(SummingArrayCombiner.VarLongArrayEncoder.class, SummingArrayCombiner.Type.VARLEN);
     sumArray(SummingArrayCombiner.FixedLongArrayEncoder.class, SummingArrayCombiner.Type.FIXEDLEN);
     sumArray(SummingArrayCombiner.StringArrayEncoder.class, SummingArrayCombiner.Type.STRING);
diff --git a/core/src/test/java/org/apache/accumulo/core/iterators/user/TestCfCqSlice.java b/core/src/test/java/org/apache/accumulo/core/iterators/user/TestCfCqSlice.java
index 0f8360c..ea46580 100644
--- a/core/src/test/java/org/apache/accumulo/core/iterators/user/TestCfCqSlice.java
+++ b/core/src/test/java/org/apache/accumulo/core/iterators/user/TestCfCqSlice.java
@@ -288,7 +288,8 @@ public abstract class TestCfCqSlice {
     firstOpts.put(CfCqSliceOpts.OPT_MAX_CF, new String(LONG_LEX.encode(sliceMaxCf), UTF_8));
     secondOpts.put(CfCqSliceOpts.OPT_MIN_CQ, new String(LONG_LEX.encode(sliceMinCq), UTF_8));
     secondOpts.put(CfCqSliceOpts.OPT_MAX_CQ, new String(LONG_LEX.encode(sliceMaxCq), UTF_8));
-    SortedKeyValueIterator<Key,Value> skvi = getFilterClass().newInstance();
+    SortedKeyValueIterator<Key,Value> skvi =
+        getFilterClass().getDeclaredConstructor().newInstance();
     skvi.init(new SortedMapIterator(data), firstOpts, null);
     loadKvs(skvi.deepCopy(null), foundKvs, secondOpts, INFINITY);
     for (int i = 0; i < LR_DIM; i++) {
@@ -373,7 +374,8 @@ public abstract class TestCfCqSlice {
   private void loadKvs(SortedKeyValueIterator<Key,Value> parent, boolean[][][] foundKvs,
       Map<String,String> options, Range range) {
     try {
-      SortedKeyValueIterator<Key,Value> skvi = getFilterClass().newInstance();
+      SortedKeyValueIterator<Key,Value> skvi =
+          getFilterClass().getDeclaredConstructor().newInstance();
       skvi.init(parent, options, null);
       skvi.seek(range, EMPTY_CF_SET, false);
 
diff --git a/core/src/test/java/org/apache/accumulo/core/iterators/user/TransformingIteratorTest.java b/core/src/test/java/org/apache/accumulo/core/iterators/user/TransformingIteratorTest.java
index 6954fd7..78d82e9 100644
--- a/core/src/test/java/org/apache/accumulo/core/iterators/user/TransformingIteratorTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/iterators/user/TransformingIteratorTest.java
@@ -88,8 +88,8 @@ public class TransformingIteratorTest {
     ReuseIterator reuserIter = new ReuseIterator();
     reuserIter.init(visFilter, EMPTY_OPTS, null);
     try {
-      titer = clazz.newInstance();
-    } catch (InstantiationException | IllegalAccessException e) {
+      titer = clazz.getDeclaredConstructor().newInstance();
+    } catch (ReflectiveOperationException e) {
       throw new RuntimeException(e);
     }
 
@@ -143,7 +143,7 @@ public class TransformingIteratorTest {
       setUpTransformIterator(clazz);
 
       // All rows with visibilities reversed
-      TransformingIterator iter = clazz.newInstance();
+      TransformingIterator iter = clazz.getDeclaredConstructor().newInstance();
       TreeMap<Key,Value> expected = new TreeMap<>();
       for (int row = 1; row <= 3; ++row) {
         for (int cf = 1; cf <= 3; ++cf) {
diff --git a/iterator-test-harness/src/main/java/org/apache/accumulo/iteratortest/IteratorTestCaseFinder.java b/iterator-test-harness/src/main/java/org/apache/accumulo/iteratortest/IteratorTestCaseFinder.java
index 537197a..f6ed1da 100644
--- a/iterator-test-harness/src/main/java/org/apache/accumulo/iteratortest/IteratorTestCaseFinder.java
+++ b/iterator-test-harness/src/main/java/org/apache/accumulo/iteratortest/IteratorTestCaseFinder.java
@@ -70,8 +70,8 @@ public class IteratorTestCaseFinder {
       }
 
       try {
-        testCases.add((IteratorTestCase) clz.newInstance());
-      } catch (IllegalAccessException | InstantiationException e) {
+        testCases.add((IteratorTestCase) clz.getDeclaredConstructor().newInstance());
+      } catch (ReflectiveOperationException e) {
         log.warn("Could not instantiate {}", clz, e);
       }
     }
diff --git a/iterator-test-harness/src/main/java/org/apache/accumulo/iteratortest/IteratorTestUtil.java b/iterator-test-harness/src/main/java/org/apache/accumulo/iteratortest/IteratorTestUtil.java
index 571b676..464bb66 100644
--- a/iterator-test-harness/src/main/java/org/apache/accumulo/iteratortest/IteratorTestUtil.java
+++ b/iterator-test-harness/src/main/java/org/apache/accumulo/iteratortest/IteratorTestUtil.java
@@ -32,8 +32,8 @@ public class IteratorTestUtil {
 
   public static SortedKeyValueIterator<Key,Value> instantiateIterator(IteratorTestInput input) {
     try {
-      return requireNonNull(input.getIteratorClass()).newInstance();
-    } catch (InstantiationException | IllegalAccessException e) {
+      return requireNonNull(input.getIteratorClass()).getDeclaredConstructor().newInstance();
+    } catch (ReflectiveOperationException e) {
       throw new RuntimeException(e);
     }
   }
diff --git a/iterator-test-harness/src/main/java/org/apache/accumulo/iteratortest/testcases/InstantiationTestCase.java b/iterator-test-harness/src/main/java/org/apache/accumulo/iteratortest/testcases/InstantiationTestCase.java
index e9341d5..81534a3 100644
--- a/iterator-test-harness/src/main/java/org/apache/accumulo/iteratortest/testcases/InstantiationTestCase.java
+++ b/iterator-test-harness/src/main/java/org/apache/accumulo/iteratortest/testcases/InstantiationTestCase.java
@@ -35,7 +35,7 @@ public class InstantiationTestCase implements IteratorTestCase {
     try {
       // We should be able to instantiate the Iterator given the Class
       @SuppressWarnings("unused")
-      SortedKeyValueIterator<Key,Value> iter = clz.newInstance();
+      SortedKeyValueIterator<Key,Value> iter = clz.getDeclaredConstructor().newInstance();
     } catch (Exception e) {
       return new IteratorTestOutput(e);
     }
diff --git a/server/base/src/main/java/org/apache/accumulo/server/ServiceEnvironmentImpl.java b/server/base/src/main/java/org/apache/accumulo/server/ServiceEnvironmentImpl.java
index 3f6465f..3fb3a7a 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/ServiceEnvironmentImpl.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/ServiceEnvironmentImpl.java
@@ -127,13 +127,13 @@ public class ServiceEnvironmentImpl implements ServiceEnvironment {
 
   @Override
   public <T> T instantiate(String className, Class<T> base)
-      throws ClassNotFoundException, InstantiationException, IllegalAccessException, IOException {
+      throws ReflectiveOperationException, IOException {
     return ConfigurationTypeHelper.getClassInstance(null, className, base);
   }
 
   @Override
   public <T> T instantiate(TableId tableId, String className, Class<T> base)
-      throws ClassNotFoundException, InstantiationException, IllegalAccessException, IOException {
+      throws ReflectiveOperationException, IOException {
     String ctx =
         srvCtx.getServerConfFactory().getTableConfiguration(tableId).get(Property.TABLE_CLASSPATH);
     return ConfigurationTypeHelper.getClassInstance(ctx, className, base);
diff --git a/server/base/src/main/java/org/apache/accumulo/server/client/ClientServiceHandler.java b/server/base/src/main/java/org/apache/accumulo/server/client/ClientServiceHandler.java
index 76e190e..d9638a8 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/client/ClientServiceHandler.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/client/ClientServiceHandler.java
@@ -368,10 +368,9 @@ public class ClientServiceHandler implements ClientService.Iface {
     try {
       shouldMatch = loader.loadClass(interfaceMatch);
       Class test = AccumuloVFSClassLoader.loadClass(className, shouldMatch);
-      test.newInstance();
+      test.getDeclaredConstructor().newInstance();
       return true;
-    } catch (ClassCastException | IllegalAccessException | InstantiationException
-        | ClassNotFoundException e) {
+    } catch (ClassCastException | ReflectiveOperationException e) {
       log.warn("Error checking object types", e);
       return false;
     }
@@ -404,7 +403,7 @@ public class ClientServiceHandler implements ClientService.Iface {
       }
 
       Class<?> test = currentLoader.loadClass(className).asSubclass(shouldMatch);
-      test.newInstance();
+      test.getDeclaredConstructor().newInstance();
       return true;
     } catch (Exception e) {
       log.warn("Error checking object types", e);
@@ -440,7 +439,7 @@ public class ClientServiceHandler implements ClientService.Iface {
       }
 
       Class<?> test = currentLoader.loadClass(className).asSubclass(shouldMatch);
-      test.newInstance();
+      test.getDeclaredConstructor().newInstance();
       return true;
     } catch (Exception e) {
       log.warn("Error checking object types", e);
diff --git a/server/base/src/main/java/org/apache/accumulo/server/replication/ReplicaSystemFactory.java b/server/base/src/main/java/org/apache/accumulo/server/replication/ReplicaSystemFactory.java
index 493e8ee..7fe0732 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/replication/ReplicaSystemFactory.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/replication/ReplicaSystemFactory.java
@@ -41,7 +41,7 @@ public class ReplicaSystemFactory {
       Class<?> clz = Class.forName(entry.getKey());
 
       if (ReplicaSystem.class.isAssignableFrom(clz)) {
-        Object o = clz.newInstance();
+        Object o = clz.getDeclaredConstructor().newInstance();
         ReplicaSystem rs = (ReplicaSystem) o;
         rs.configure(context, entry.getValue());
         return rs;
@@ -49,7 +49,7 @@ public class ReplicaSystemFactory {
 
       throw new IllegalArgumentException(
           "Class is not assignable to ReplicaSystem: " + entry.getKey());
-    } catch (ClassNotFoundException | InstantiationException | IllegalAccessException e) {
+    } catch (ReflectiveOperationException e) {
       log.error("Error creating ReplicaSystem object", e);
       throw new IllegalArgumentException(e);
     }
diff --git a/server/base/src/main/java/org/apache/accumulo/server/util/DefaultMap.java b/server/base/src/main/java/org/apache/accumulo/server/util/DefaultMap.java
index 027cc92..5cca4b3 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/util/DefaultMap.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/util/DefaultMap.java
@@ -50,7 +50,7 @@ public class DefaultMap<K,V> extends HashMap<K,V> {
   @SuppressWarnings("unchecked")
   private V construct() {
     try {
-      return (V) dfault.getClass().newInstance();
+      return (V) dfault.getClass().getDeclaredConstructor().newInstance();
     } catch (Exception ex) {
       return dfault;
     }
diff --git a/server/base/src/main/java/org/apache/accumulo/server/util/LoginProperties.java b/server/base/src/main/java/org/apache/accumulo/server/util/LoginProperties.java
index 0544afe..df2e5dd 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/util/LoginProperties.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/util/LoginProperties.java
@@ -47,7 +47,7 @@ public class LoginProperties implements KeywordExecutable {
       AccumuloConfiguration config = context.getServerConfFactory().getSystemConfiguration();
       Authenticator authenticator = AccumuloVFSClassLoader.getClassLoader()
           .loadClass(config.get(Property.INSTANCE_SECURITY_AUTHENTICATOR))
-          .asSubclass(Authenticator.class).newInstance();
+          .asSubclass(Authenticator.class).getDeclaredConstructor().newInstance();
 
       System.out
           .println("Supported token types for " + authenticator.getClass().getName() + " are : ");
@@ -56,7 +56,8 @@ public class LoginProperties implements KeywordExecutable {
         System.out
             .println("\t" + tokenType.getName() + ", which accepts the following properties : ");
 
-        for (TokenProperty tokenProperty : tokenType.newInstance().getProperties()) {
+        for (TokenProperty tokenProperty : tokenType.getDeclaredConstructor().newInstance()
+            .getProperties()) {
           System.out.println("\t\t" + tokenProperty);
         }
 
diff --git a/server/master/src/main/java/org/apache/accumulo/master/replication/WorkDriver.java b/server/master/src/main/java/org/apache/accumulo/master/replication/WorkDriver.java
index c17f8ca..e687ea2 100644
--- a/server/master/src/main/java/org/apache/accumulo/master/replication/WorkDriver.java
+++ b/server/master/src/main/java/org/apache/accumulo/master/replication/WorkDriver.java
@@ -59,8 +59,8 @@ public class WorkDriver extends Daemon {
       try {
         Class<?> clz = Class.forName(workAssignerClass);
         Class<? extends WorkAssigner> workAssignerClz = clz.asSubclass(WorkAssigner.class);
-        this.assigner = workAssignerClz.newInstance();
-      } catch (ClassNotFoundException | InstantiationException | IllegalAccessException e) {
+        this.assigner = workAssignerClz.getDeclaredConstructor().newInstance();
+      } catch (ReflectiveOperationException e) {
         log.error("Could not instantiate configured work assigner {}", workAssignerClass, e);
         throw new RuntimeException(e);
       }
diff --git a/server/tracer/src/main/java/org/apache/accumulo/tracer/TraceServer.java b/server/tracer/src/main/java/org/apache/accumulo/tracer/TraceServer.java
index fd6b02a..cc68f4a 100644
--- a/server/tracer/src/main/java/org/apache/accumulo/tracer/TraceServer.java
+++ b/server/tracer/src/main/java/org/apache/accumulo/tracer/TraceServer.java
@@ -243,8 +243,7 @@ public class TraceServer implements Watcher, AutoCloseable {
    *           if the trace user has the wrong permissions
    */
   private AccumuloClient ensureTraceTableExists(final AccumuloConfiguration conf)
-      throws AccumuloSecurityException, ClassNotFoundException, InstantiationException,
-      IllegalAccessException {
+      throws AccumuloSecurityException, ReflectiveOperationException {
     AccumuloClient accumuloClient = null;
     while (true) {
       try {
@@ -266,7 +265,7 @@ public class TraceServer implements Watcher, AutoCloseable {
           Properties props = new Properties();
           AuthenticationToken token =
               AccumuloVFSClassLoader.getClassLoader().loadClass(conf.get(Property.TRACE_TOKEN_TYPE))
-                  .asSubclass(AuthenticationToken.class).newInstance();
+                  .asSubclass(AuthenticationToken.class).getDeclaredConstructor().newInstance();
 
           int prefixLength = Property.TRACE_TOKEN_PROPERTY_PREFIX.getKey().length();
           for (Entry<String,String> entry : loginMap.entrySet()) {
diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/constraints/ConstraintChecker.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/constraints/ConstraintChecker.java
index 400f691..a375d12 100644
--- a/server/tserver/src/main/java/org/apache/accumulo/tserver/constraints/ConstraintChecker.java
+++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/constraints/ConstraintChecker.java
@@ -66,7 +66,7 @@ public class ConstraintChecker {
           Class<? extends Constraint> clazz =
               loader.loadClass(className).asSubclass(Constraint.class);
           log.debug("Loaded constraint {} for {}", clazz.getName(), conf.getTableId());
-          constrains.add(clazz.newInstance());
+          constrains.add(clazz.getDeclaredConstructor().newInstance());
         }
       }
 
diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/replication/ReplicationServicerHandler.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/replication/ReplicationServicerHandler.java
index cb1cfb3..3b7d13c 100644
--- a/server/tserver/src/main/java/org/apache/accumulo/tserver/replication/ReplicationServicerHandler.java
+++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/replication/ReplicationServicerHandler.java
@@ -94,8 +94,8 @@ public class ReplicationServicerHandler implements Iface {
     // Create an instance
     AccumuloReplicationReplayer replayer;
     try {
-      replayer = clz.newInstance();
-    } catch (InstantiationException | IllegalAccessException e1) {
+      replayer = clz.getDeclaredConstructor().newInstance();
+    } catch (ReflectiveOperationException e1) {
       log.error("Could not instantiate replayer class {}", clz.getName());
       throw new RemoteReplicationException(RemoteReplicationErrorCode.CANNOT_INSTANTIATE_REPLAYER,
           "Could not instantiate replayer class" + clz.getName());
diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/Tablet.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/Tablet.java
index f71c4f5..bda08c9 100644
--- a/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/Tablet.java
+++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/Tablet.java
@@ -2719,7 +2719,7 @@ public class Tablet {
       } else {
         clazz = AccumuloVFSClassLoader.loadClass(clazzName, CompactionStrategy.class);
       }
-      CompactionStrategy strategy = clazz.newInstance();
+      CompactionStrategy strategy = clazz.getDeclaredConstructor().newInstance();
       strategy.init(strategyConfig.getOptions());
       return strategy;
     } catch (Exception e) {
diff --git a/shell/src/main/java/org/apache/accumulo/shell/commands/ScanCommand.java b/shell/src/main/java/org/apache/accumulo/shell/commands/ScanCommand.java
index 899a888..273b188 100644
--- a/shell/src/main/java/org/apache/accumulo/shell/commands/ScanCommand.java
+++ b/shell/src/main/java/org/apache/accumulo/shell/commands/ScanCommand.java
@@ -240,7 +240,7 @@ public class ScanCommand extends Command {
     if (clazz == null)
       clazz = DefaultScanInterpreter.class;
 
-    return clazz.newInstance();
+    return clazz.getDeclaredConstructor().newInstance();
   }
 
   protected Class<? extends Formatter> getFormatter(final CommandLine cl, final String tableName,
diff --git a/shell/src/main/java/org/apache/accumulo/shell/commands/SetIterCommand.java b/shell/src/main/java/org/apache/accumulo/shell/commands/SetIterCommand.java
index 5eabad4..026c544 100644
--- a/shell/src/main/java/org/apache/accumulo/shell/commands/SetIterCommand.java
+++ b/shell/src/main/java/org/apache/accumulo/shell/commands/SetIterCommand.java
@@ -205,8 +205,8 @@ public class SetIterCommand extends Command {
     Class<? extends SortedKeyValueIterator> clazz;
     try {
       clazz = classloader.loadClass(className).asSubclass(SortedKeyValueIterator.class);
-      untypedInstance = clazz.newInstance();
-    } catch (ClassNotFoundException e) {
+      untypedInstance = clazz.getDeclaredConstructor().newInstance();
+    } catch (ReflectiveOperationException e) {
       StringBuilder msg = new StringBuilder("Unable to load ").append(className);
       if (className.indexOf('.') < 0) {
         msg.append("; did you use a fully qualified package name?");
@@ -214,8 +214,6 @@ public class SetIterCommand extends Command {
         msg.append("; class not found.");
       }
       throw new ShellCommandException(ErrorCode.INITIALIZATION_FAILURE, msg.toString());
-    } catch (InstantiationException | IllegalAccessException e) {
-      throw new IllegalArgumentException(e.getMessage());
     } catch (ClassCastException e) {
       String msg = className + " loaded successfully but does not implement SortedKeyValueIterator."
           + " This class cannot be used with this command.";
diff --git a/start/src/main/java/org/apache/accumulo/start/Main.java b/start/src/main/java/org/apache/accumulo/start/Main.java
index 373e5a3..a006fe7 100644
--- a/start/src/main/java/org/apache/accumulo/start/Main.java
+++ b/start/src/main/java/org/apache/accumulo/start/Main.java
@@ -57,7 +57,7 @@ public class Main {
       }
       Object conf = null;
       try {
-        conf = confClass.newInstance();
+        conf = confClass.getDeclaredConstructor().newInstance();
       } catch (Exception e) {
         log.error("Error creating new instance of Hadoop Configuration", e);
         System.exit(1);
@@ -103,8 +103,7 @@ public class Main {
       try {
         classLoader = (ClassLoader) getVFSClassLoader().getMethod("getClassLoader").invoke(null);
         Thread.currentThread().setContextClassLoader(classLoader);
-      } catch (ClassNotFoundException | IOException | IllegalAccessException
-          | IllegalArgumentException | InvocationTargetException | NoSuchMethodException
+      } catch (IOException | IllegalArgumentException | ReflectiveOperationException
           | SecurityException e) {
         log.error("Problem initializing the class loader", e);
         System.exit(1);
diff --git a/start/src/test/java/org/apache/accumulo/start/classloader/vfs/AccumuloReloadingVFSClassLoaderTest.java b/start/src/test/java/org/apache/accumulo/start/classloader/vfs/AccumuloReloadingVFSClassLoaderTest.java
index c3806b5..215ff29 100644
--- a/start/src/test/java/org/apache/accumulo/start/classloader/vfs/AccumuloReloadingVFSClassLoaderTest.java
+++ b/start/src/test/java/org/apache/accumulo/start/classloader/vfs/AccumuloReloadingVFSClassLoaderTest.java
@@ -96,7 +96,7 @@ public class AccumuloReloadingVFSClassLoaderTest {
     arvcl.setMaxRetries(1);
 
     Class<?> clazz1 = arvcl.getClassLoader().loadClass("test.HelloWorld");
-    Object o1 = clazz1.newInstance();
+    Object o1 = clazz1.getDeclaredConstructor().newInstance();
     assertEquals("Hello World!", o1.toString());
 
     // Check that the class is the same before the update
@@ -117,7 +117,7 @@ public class AccumuloReloadingVFSClassLoaderTest {
     Thread.sleep(7000);
 
     Class<?> clazz2 = arvcl.getClassLoader().loadClass("test.HelloWorld");
-    Object o2 = clazz2.newInstance();
+    Object o2 = clazz2.getDeclaredConstructor().newInstance();
     assertEquals("Hello World!", o2.toString());
 
     // This is false because they are loaded by a different classloader
@@ -142,7 +142,7 @@ public class AccumuloReloadingVFSClassLoaderTest {
     arvcl.setMaxRetries(3);
 
     Class<?> clazz1 = arvcl.getClassLoader().loadClass("test.HelloWorld");
-    Object o1 = clazz1.newInstance();
+    Object o1 = clazz1.getDeclaredConstructor().newInstance();
     assertEquals("Hello World!", o1.toString());
 
     // Check that the class is the same before the update
@@ -163,7 +163,7 @@ public class AccumuloReloadingVFSClassLoaderTest {
     Thread.sleep(7000);
 
     Class<?> clazz2 = arvcl.getClassLoader().loadClass("test.HelloWorld");
-    Object o2 = clazz2.newInstance();
+    Object o2 = clazz2.getDeclaredConstructor().newInstance();
     assertEquals("Hello World!", o2.toString());
 
     // This is true because they are loaded by the same classloader due to the new retry
diff --git a/start/src/test/java/org/apache/accumulo/start/classloader/vfs/AccumuloVFSClassLoaderTest.java b/start/src/test/java/org/apache/accumulo/start/classloader/vfs/AccumuloVFSClassLoaderTest.java
index 2600948..83ebc37 100644
--- a/start/src/test/java/org/apache/accumulo/start/classloader/vfs/AccumuloVFSClassLoaderTest.java
+++ b/start/src/test/java/org/apache/accumulo/start/classloader/vfs/AccumuloVFSClassLoaderTest.java
@@ -139,7 +139,7 @@ public class AccumuloVFSClassLoaderTest {
     // We can't be sure what the authority/host will be due to FQDN mappings, so just check the path
     assertTrue(arvcl.getFileObjects()[0].getURL().toString().contains("HelloWorld.jar"));
     Class<?> clazz1 = arvcl.loadClass("test.HelloWorld");
-    Object o1 = clazz1.newInstance();
+    Object o1 = clazz1.getDeclaredConstructor().newInstance();
     assertEquals("Hello World!", o1.toString());
     Whitebox.setInternalState(AccumuloVFSClassLoader.class, "loader",
         (AccumuloReloadingVFSClassLoader) null);
diff --git a/start/src/test/java/org/apache/accumulo/start/classloader/vfs/ContextManagerTest.java b/start/src/test/java/org/apache/accumulo/start/classloader/vfs/ContextManagerTest.java
index 8d9f5fa..6bb879c 100644
--- a/start/src/test/java/org/apache/accumulo/start/classloader/vfs/ContextManagerTest.java
+++ b/start/src/test/java/org/apache/accumulo/start/classloader/vfs/ContextManagerTest.java
@@ -111,11 +111,11 @@ public class ContextManagerTest {
     assertArrayEquals(createFileSystems(dirContents2), files2);
 
     Class<?> defaultContextClass = cl1.loadClass("test.HelloWorld");
-    Object o1 = defaultContextClass.newInstance();
+    Object o1 = defaultContextClass.getDeclaredConstructor().newInstance();
     assertEquals("Hello World!", o1.toString());
 
     Class<?> myContextClass = cl2.loadClass("test.HelloWorld");
-    Object o2 = myContextClass.newInstance();
+    Object o2 = myContextClass.getDeclaredConstructor().newInstance();
     assertEquals("Hello World!", o2.toString());
 
     assertNotEquals(defaultContextClass, myContextClass);
diff --git a/start/src/test/java/org/apache/accumulo/start/classloader/vfs/providers/VfsClassLoaderTest.java b/start/src/test/java/org/apache/accumulo/start/classloader/vfs/providers/VfsClassLoaderTest.java
index 2a66c49..2429ef5 100644
--- a/start/src/test/java/org/apache/accumulo/start/classloader/vfs/providers/VfsClassLoaderTest.java
+++ b/start/src/test/java/org/apache/accumulo/start/classloader/vfs/providers/VfsClassLoaderTest.java
@@ -62,7 +62,7 @@ public class VfsClassLoaderTest extends AccumuloDFSBase {
   @Test
   public void testGetClass() throws Exception {
     Class<?> helloWorldClass = this.cl.loadClass("test.HelloWorld");
-    Object o = helloWorldClass.newInstance();
+    Object o = helloWorldClass.getDeclaredConstructor().newInstance();
     assertEquals("Hello World!", o.toString());
   }
 
diff --git a/test/src/main/java/org/apache/accumulo/test/BatchWriterIterator.java b/test/src/main/java/org/apache/accumulo/test/BatchWriterIterator.java
index bf5ab31..4bf65e8 100644
--- a/test/src/main/java/org/apache/accumulo/test/BatchWriterIterator.java
+++ b/test/src/main/java/org/apache/accumulo/test/BatchWriterIterator.java
@@ -264,7 +264,7 @@ public class BatchWriterIterator extends WrappingIterator {
   public SortedKeyValueIterator<Key,Value> deepCopy(IteratorEnvironment env) {
     BatchWriterIterator newInstance;
     try {
-      newInstance = this.getClass().newInstance();
+      newInstance = this.getClass().getDeclaredConstructor().newInstance();
       newInstance.init(getSource().deepCopy(env), originalOptions, env);
       return newInstance;
     } catch (Exception e) {
diff --git a/test/src/main/java/org/apache/accumulo/test/HardListIterator.java b/test/src/main/java/org/apache/accumulo/test/HardListIterator.java
index ae0489e..f521165 100644
--- a/test/src/main/java/org/apache/accumulo/test/HardListIterator.java
+++ b/test/src/main/java/org/apache/accumulo/test/HardListIterator.java
@@ -74,7 +74,7 @@ public class HardListIterator implements SortedKeyValueIterator<Key,Value> {
   public SortedKeyValueIterator<Key,Value> deepCopy(IteratorEnvironment env) {
     HardListIterator newInstance;
     try {
-      newInstance = HardListIterator.class.newInstance();
+      newInstance = HardListIterator.class.getDeclaredConstructor().newInstance();
     } catch (Exception e) {
       throw new RuntimeException(e);
     }
diff --git a/test/src/main/java/org/apache/accumulo/test/util/SerializationUtil.java b/test/src/main/java/org/apache/accumulo/test/util/SerializationUtil.java
index d68ad47..28273e6 100644
--- a/test/src/main/java/org/apache/accumulo/test/util/SerializationUtil.java
+++ b/test/src/main/java/org/apache/accumulo/test/util/SerializationUtil.java
@@ -65,8 +65,8 @@ public class SerializationUtil {
           classname + " is not a subclass of " + parentClass.getName(), e);
     }
     try {
-      return cm.newInstance();
-    } catch (InstantiationException | IllegalAccessException e) {
+      return cm.getDeclaredConstructor().newInstance();
+    } catch (ReflectiveOperationException e) {
       throw new IllegalArgumentException("can't instantiate new instance of " + cm.getName(), e);
     }
   }


Mime
View raw message