refactor to remove deprecation warning for newInstance
This commit is contained in:
parent
08b76e0b7e
commit
78df43569a
@ -1,5 +1,6 @@
|
|||||||
package net.sf.openrocket.document;
|
package net.sf.openrocket.document;
|
||||||
|
|
||||||
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.util.EventListener;
|
import java.util.EventListener;
|
||||||
import java.util.EventObject;
|
import java.util.EventObject;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -350,13 +351,15 @@ public class Simulation implements ChangeSource, Cloneable {
|
|||||||
SimulationEngine simulator;
|
SimulationEngine simulator;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
simulator = simulationEngineClass.newInstance();
|
simulator = simulationEngineClass.getConstructor().newInstance();
|
||||||
} catch (InstantiationException e) {
|
} catch (InstantiationException e) {
|
||||||
throw new IllegalStateException("Cannot instantiate simulator.", e);
|
throw new IllegalStateException("Cannot instantiate simulator.", e);
|
||||||
} catch (IllegalAccessException e) {
|
} catch (IllegalAccessException e) {
|
||||||
throw new IllegalStateException("Cannot access simulator instance?! BUG!", e);
|
throw new IllegalStateException("Cannot access simulator instance?! BUG!", e);
|
||||||
|
} catch (InvocationTargetException | NoSuchMethodException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
SimulationConditions simulationConditions = options.toSimulationConditions();
|
SimulationConditions simulationConditions = options.toSimulationConditions();
|
||||||
simulationConditions.setSimulation(this);
|
simulationConditions.setSimulation(this);
|
||||||
for (SimulationListener l : additionalListeners) {
|
for (SimulationListener l : additionalListeners) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user