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;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.EventListener;
|
||||
import java.util.EventObject;
|
||||
import java.util.List;
|
||||
@ -350,13 +351,15 @@ public class Simulation implements ChangeSource, Cloneable {
|
||||
SimulationEngine simulator;
|
||||
|
||||
try {
|
||||
simulator = simulationEngineClass.newInstance();
|
||||
simulator = simulationEngineClass.getConstructor().newInstance();
|
||||
} catch (InstantiationException e) {
|
||||
throw new IllegalStateException("Cannot instantiate simulator.", e);
|
||||
} catch (IllegalAccessException e) {
|
||||
throw new IllegalStateException("Cannot access simulator instance?! BUG!", e);
|
||||
} catch (InvocationTargetException | NoSuchMethodException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
|
||||
SimulationConditions simulationConditions = options.toSimulationConditions();
|
||||
simulationConditions.setSimulation(this);
|
||||
for (SimulationListener l : additionalListeners) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user