Object (Class<?> aClass) { try { if (Modifier.isAbstract(aClass.getModifiers())) return null; final Constructor<?> constructor; try { constructor = aClass.getConstructor(); } catch (NoSuchMethodException e) { return null; } constructor.setAccessible(true); return constructor.newInstance(); } catch (InstantiationException | IllegalAccessException | InvocationTargetException e) { System.err.println("Not instantiated " + aClass + " " + e); return null; } }