Merge pull request #1517 from thzero/simulationdeprecation
Refactor to remove deprecation warning for newInstance
This commit is contained in:
		
						commit
						ffb78446c9
					
				@ -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,11 +351,13 @@ 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();
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user