Fix Class.newInstance() deprecation warnings.

This commit is contained in:
Ray J. Greenwell
2026-03-21 15:55:45 -07:00
parent 4ddc4e2f8a
commit 195562435b
4 changed files with 7 additions and 8 deletions
@@ -56,7 +56,7 @@ public abstract class PlaceConfig extends SimpleStreamableObject
log.warning("Providing backwards compatibility. PlaceConfig." +
"createController() should be overridden directly.");
try {
return (PlaceController)cclass.newInstance();
return (PlaceController)cclass.getConstructor().newInstance();
} catch (Exception e) {
log.warning("Failed to instantiate controller class '" + cclass + "'.", e);
return null;
@@ -461,7 +461,7 @@ public class PlaceManager
protected PlaceObject createPlaceObject ()
{
try {
return getPlaceObjectClass().newInstance();
return getPlaceObjectClass().getConstructor().newInstance();
} catch (Exception e) {
throw new RuntimeException(e);
}
@@ -155,13 +155,12 @@ public class InvocationManager
// create a marshaller instance and initialize it
T marsh;
try {
marsh = mclass.newInstance();
marsh = mclass.getConstructor().newInstance();
marsh.init(_invoid, invCode, _standaloneClient == null ?
null : _standaloneClient.getInvocationDirector());
} catch (IllegalAccessException ie) {
throw new RuntimeException(ie);
} catch (InstantiationException ie) {
throw new RuntimeException(ie);
} catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException |
InstantiationException ee) {
throw new RuntimeException(ee);
}
// register the dispatcher
@@ -113,7 +113,7 @@ public class PresentsServer
try {
log.info("Invoking test module", "mod", testmod);
Class<?> tmclass = Class.forName(testmod);
Runnable trun = (Runnable)tmclass.newInstance();
Runnable trun = (Runnable)tmclass.getConstructor().newInstance();
trun.run();
} catch (Exception e) {
log.warning("Unable to invoke test module '" + testmod + "'.", e);