mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-20 19:14:38 +02:00
8155880: Fix langtools usage of the deprecated Class.newInstance method
Reviewed-by: mcimadamore
This commit is contained in:
parent
2c8f465c47
commit
c52bd6ba1d
5 changed files with 39 additions and 40 deletions
|
@ -125,9 +125,8 @@ public class ToolProvider {
|
|||
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);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue