docs: <T> InternalProviderImpl<T> toProvider(Binding<T> binding) {
      if (binding == null) {
        throw new IllegalStateException("null binding are not allowed. Should not happen unless getBindingSet is overridden.");
      }
      ConfigurationHolder.configuration.checkIllegalBinding(binding, this);
  
      switch (binding.getMode()) {
        case SIMPLE:
          return createInternalProvider(this,
              binding.getKey(),
              false,
              binding.isCreatingInstancesInScope(),
              binding.isCreatingSingletonInScope(),
              false);
        case CLASS:
          return createInternalProvider(this,
              binding.getImplementationClass(),
              false,
              binding.isCreatingInstancesInScope(),
              binding.isCreatingSingletonInScope(),
              false);
        case INSTANCE:
          return new InternalProviderImpl<>(binding.getInstance());
        case PROVIDER_INSTANCE:
          // to ensure providers do not have to deal with concurrency, we wrap them in a thread safe provider
          // We do not need to pass the scope here because the provider won't use any scope to create the instance
          return new InternalProviderImpl<>(binding.getProviderInstance(), binding.isProvidingSingletonInScope());
        case PROVIDER_CLASS:
          return createInternalProvider(this,
              binding.getProviderClass(),
              true,
              binding.isCreatingInstancesInScope(),
              binding.isCreatingSingletonInScope(),
              binding.isProvidingSingletonInScope());
        //JACOCO:OFF
        default:
          throw new IllegalStateException(format("mode is not handled: %s. This should not happen.", binding.getMode()));
          //JACOCO:ON
      }
    }