private static boolean shouldGenerateCheckNotNull(FactoryDescriptor descriptor) {
    if (!descriptor.providers().isEmpty()) {
      return true;
    }
    for (FactoryMethodDescriptor method : descriptor.methodDescriptors()) {
      for (Parameter parameter : method.creationParameters()) {
        if (!parameter.nullable().isPresent() && !parameter.type().get().getKind().isPrimitive()) {
          return true;
        }
      }
    }
    return false;
  }
{@link ParameterSpec}s to match {@code parameters}. Note that the type of the {@link
ParameterSpec}s match {@link Parameter#type()} and not {@link Key#type()}.
factory/src/main/java/com/google/auto/factory/processor/FactoryWriter.java