mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-20 19:14:38 +02:00
8155516: Suppress warnings from uses of deprecated Class.newInstance langtools
Reviewed-by: jjg
This commit is contained in:
parent
325a065aff
commit
ae6a62a6c8
5 changed files with 13 additions and 5 deletions
|
@ -123,7 +123,9 @@ public class ToolProvider {
|
|||
private static <T> T getSystemTool(Class<T> clazz, String moduleName, String className) {
|
||||
if (useLegacy) {
|
||||
try {
|
||||
return Class.forName(className, true, ClassLoader.getSystemClassLoader()).asSubclass(clazz).newInstance();
|
||||
@SuppressWarnings("deprecation")
|
||||
T result = Class.forName(className, true, ClassLoader.getSystemClassLoader()).asSubclass(clazz).newInstance();
|
||||
return result;
|
||||
} catch (ReflectiveOperationException e) {
|
||||
throw new Error(e);
|
||||
}
|
||||
|
|
|
@ -282,6 +282,7 @@ public class JavacProcessingEnvironment implements ProcessingEnvironment, Closea
|
|||
|
||||
if (options.isSet(XPRINT)) {
|
||||
try {
|
||||
@SuppressWarnings("deprecation")
|
||||
Processor processor = PrintingProcessor.class.newInstance();
|
||||
processorIterator = List.of(processor).iterator();
|
||||
} catch (Throwable t) {
|
||||
|
@ -549,8 +550,9 @@ public class JavacProcessingEnvironment implements ProcessingEnvironment, Closea
|
|||
try {
|
||||
Class<?> processorClass = processorCL.loadClass(processorName);
|
||||
ensureReadable(processorClass);
|
||||
processor =
|
||||
(Processor) (processorClass.newInstance());
|
||||
@SuppressWarnings("deprecation")
|
||||
Object tmp = processorClass.newInstance();
|
||||
processor = (Processor) tmp;
|
||||
} catch (ClassNotFoundException cnfe) {
|
||||
log.error("proc.processor.not.found", processorName);
|
||||
return false;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -151,6 +151,7 @@ public enum Option {
|
|||
// Construct transformer
|
||||
try {
|
||||
Class<?> trCls = Class.forName(classname);
|
||||
@SuppressWarnings("deprecation")
|
||||
Transformer transformer = (Transformer) trCls.newInstance();
|
||||
transformer.setExtra(extra);
|
||||
helper.addTransformer(suffix, transformer);
|
||||
|
|
|
@ -246,6 +246,7 @@ public class TagletManager {
|
|||
}
|
||||
tagClassLoader = fileManager.getClassLoader(TAGLET_PATH);
|
||||
Class<?> customTagClass = tagClassLoader.loadClass(classname);
|
||||
@SuppressWarnings("deprecation")
|
||||
Object instance = customTagClass.newInstance();
|
||||
Taglet newLegacy = new UserTaglet((jdk.javadoc.doclet.taglet.Taglet)instance);
|
||||
String tname = newLegacy.getName();
|
||||
|
|
|
@ -270,7 +270,9 @@ public class Start extends ToolOption.Helper {
|
|||
initMessager();
|
||||
messager.setLocale(locale);
|
||||
try {
|
||||
doclet = (Doclet) docletClass.newInstance();
|
||||
@SuppressWarnings("deprecation")
|
||||
Object o = docletClass.newInstance();
|
||||
doclet = (Doclet) o;
|
||||
} catch (InstantiationException | IllegalAccessException exc) {
|
||||
exc.printStackTrace();
|
||||
if (!apiMode) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue