private <T extends Plugin> T instantiate(String pluginString, Class<T> pluginClass, String argument) throws IOException, URISyntaxException { Constructor<T> single = findSingleArgConstructor(pluginClass); Constructor<T> empty = findEmptyConstructor(pluginClass); if (single != null) { Object ctorArg = convertOrNull(argument, single.getParameterTypes()[0], pluginString); if (ctorArg != null) return newInstance(single, ctorArg); } if (argument == null && empty != null) { return newInstance(empty); } if (single != null) throw new CucumberException(String.format("You must supply an output argument to %s. Like so: %s:output", pluginString, pluginString)); throw new CucumberException(String.format("%s must have a constructor that is either empty or a single arg of one of: %s", pluginClass, asList(CTOR_PARAMETERS))); }