private T getByKey(@NotNull List<KeyedFactoryEPBean> epBeans, @Nullable String key, @NotNull Method method, Object[] args) {
    for (KeyedFactoryEPBean epBean : epBeans) {
      if (!(epBean.key == null ? "" : epBean.key).equals(key == null ? "" : key)) {
        continue;
      }

      if (epBean.implementationClass != null) {
        return componentManager.instantiateClass(epBean.implementationClass, epBean.getPluginDescriptor());
      }

      Object factory = componentManager.instantiateClass(epBean.factoryClass, epBean.getPluginDescriptor());
      try {
        //noinspection unchecked
        T result = (T)method.invoke(factory, args);
        if (result != null) {
          return result;
        }
      }
      catch (RuntimeException e) {
        if (e instanceof ControlFlowException) {
          throw e;
        }
        throw componentManager.createError(e, epBean.getPluginDescriptor().getPluginId());
      }
      catch (Exception e) {
        throw componentManager.createError(e, epBean.getPluginDescriptor().getPluginId());
      }
    }
    return null;
  }
private T getByKey(@NotNull List<KeyedFactoryEPBean> epBeans, @Nullable String key, @NotNull Method method, Object[] args)