mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 23:04:50 +02:00
6850612: Deprecate Class.newInstance since it violates the checked exception language contract
Reviewed-by: lancea, mullan, dfuchs
This commit is contained in:
parent
e8cd76568d
commit
01ee88c8ae
71 changed files with 272 additions and 157 deletions
|
@ -159,7 +159,9 @@ public class NamingManager {
|
|||
}
|
||||
}
|
||||
|
||||
return (clas != null) ? (ObjectFactory) clas.newInstance() : null;
|
||||
@SuppressWarnings("deprecation") // Class.newInstance
|
||||
ObjectFactory result = (clas != null) ? (ObjectFactory) clas.newInstance() : null;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
@ -710,8 +712,9 @@ public class NamingManager {
|
|||
|
||||
if (factory == null) {
|
||||
try {
|
||||
factory = (InitialContextFactory)
|
||||
helper.loadClass(className).newInstance();
|
||||
@SuppressWarnings("deprecation")
|
||||
Object o = helper.loadClass(className).newInstance();
|
||||
factory = (InitialContextFactory) o;
|
||||
} catch (Exception e) {
|
||||
NoInitialContextException ne =
|
||||
new NoInitialContextException(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue