private static @NotNull Object doGetComponentInstance(@Nullable ComponentAdapter adapter, @NotNull DefaultPicoContainer container, @NotNull Class<?> componentImplementation) {
    Constructor<?> constructor;
    try {
      constructor = getGreediestSatisfiableConstructor(adapter, container, componentImplementation);
    }
    catch (AmbiguousComponentResolutionException e) {
      e.setComponent(componentImplementation);
      throw e;
    }

    try {
      constructor.setAccessible(true);
      if (constructor.getParameterCount() == 0) {
        return constructor.newInstance();
      }
      else {
        Class<?>[] parameterTypes = constructor.getParameterTypes();
        Object[] result = new Object[parameterTypes.length];
        for (int i = 0; i < parameterTypes.length; i++) {
          // type check is done in isResolvable
          ComponentAdapter componentAdapter = ComponentParameter.resolveAdapter(container, adapter, parameterTypes[i]);
          if (componentAdapter != null) {
            result[i] = container.getComponentInstance(componentAdapter.getComponentKey());
          }
        }
        return constructor.newInstance(result);
      }
    }
    catch (InvocationTargetException e) {
      ExceptionUtilRt.rethrowUnchecked(e.getTargetException());
      Throwable cause = e.getTargetException();
      throw new PicoInitializationException("InvocationTargetException: "
                                            + cause.getClass().getName()
                                            + " " + cause.getMessage(), cause);
    }
    catch (InstantiationException e) {
      throw new PicoInitializationException("Should never get here");
    }
    catch (IllegalAccessException e) {
      throw new PicoInitializationException(e);
    }
  }
private static @NotNull Object doGetComponentInstance(@Nullable ComponentAdapter adapter, @NotNull DefaultPicoContainer container, @NotNull Class<?> componentImplementation)