T (@NotNull ComponentManager componentManager) { T instance; if (factoryClass == null) { instance = super.createInstance(componentManager, getPluginDescriptor()); } else { ExtensionFactory factory = componentManager.instantiateClass(factoryClass, getPluginDescriptor()); //noinspection unchecked instance = (T)factory.createInstance(factoryArgument, getImplementationClassName()); } if (instance instanceof PluginAware) { ((PluginAware)instance).setPluginDescriptor(getPluginDescriptor()); } return instance; }