From 57bcb3967f2c2cfae543b0f10b4ceca072731b38 Mon Sep 17 00:00:00 2001 From: Paul Speed Date: Mon, 7 Mar 2016 16:35:15 -0500 Subject: [PATCH] Fix the test chooser to not instantiate the class if it's just going to call it's static main method anyway. Also, call the static main method on the class instead of an instantiated object. --- jme3-examples/src/main/java/jme3test/TestChooser.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/jme3-examples/src/main/java/jme3test/TestChooser.java b/jme3-examples/src/main/java/jme3test/TestChooser.java index a2251945e..f5f54958e 100644 --- a/jme3-examples/src/main/java/jme3test/TestChooser.java +++ b/jme3-examples/src/main/java/jme3test/TestChooser.java @@ -260,8 +260,8 @@ public class TestChooser extends JDialog { for (int i = 0; i < appClass.length; i++) { Class clazz = (Class)appClass[i]; try { - Object app = clazz.newInstance(); - if (app instanceof Application) { + if (Application.class.isAssignableFrom(clazz)) { + Object app = clazz.newInstance(); if (app instanceof SimpleApplication) { final Method settingMethod = clazz.getMethod("setShowSettings", boolean.class); settingMethod.invoke(app, showSetting); @@ -283,7 +283,7 @@ public class TestChooser extends JDialog { } } else { final Method mainMethod = clazz.getMethod("main", (new String[0]).getClass()); - mainMethod.invoke(app, new Object[]{new String[0]}); + mainMethod.invoke(clazz, new Object[]{new String[0]}); } // wait for destroy System.gc();