langtools/src/java.compiler/share/classes/javax/tools/ToolProvider.java
changeset 38918 bf1ed1a40f5b
parent 37853 b4ea8806ad1a
child 42270 3bd3e7e378b5
--- a/langtools/src/java.compiler/share/classes/javax/tools/ToolProvider.java	Mon Jun 13 12:04:09 2016 +0100
+++ b/langtools/src/java.compiler/share/classes/javax/tools/ToolProvider.java	Mon Jun 13 09:12:35 2016 -0700
@@ -125,9 +125,8 @@
     private static <T> T getSystemTool(Class<T> clazz, String moduleName, String className) {
         if (useLegacy) {
             try {
-                @SuppressWarnings("deprecation")
-                T result = Class.forName(className, true, ClassLoader.getSystemClassLoader()).asSubclass(clazz).newInstance();
-                return result;
+                return Class.forName(className, true, ClassLoader.getSystemClassLoader()).
+                    asSubclass(clazz).getConstructor().newInstance();
             } catch (ReflectiveOperationException e) {
                 throw new Error(e);
             }