6850612: Deprecate Class.newInstance since it violates the checked exception language contract

Reviewed-by: lancea, mullan, dfuchs
This commit is contained in:
Joe Darcy 2016-05-03 10:40:54 -07:00
parent e8cd76568d
commit 01ee88c8ae
71 changed files with 272 additions and 157 deletions

View file

@ -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(