// Generated from "j2kt/NullabilityInferenceProblem.java"
@file:Suppress(
 "ALWAYS_NULL",
 "PARAMETER_NAME_CHANGED_ON_OVERRIDE",
 "SENSELESS_COMPARISON",
 "UNCHECKED_CAST",
 "UNNECESSARY_LATEINIT",
 "UNNECESSARY_NOT_NULL_ASSERTION",
 "UNREACHABLE_CODE",
 "UNUSED_ANONYMOUS_PARAMETER",
 "UNUSED_PARAMETER",
 "UNUSED_VARIABLE",
 "USELESS_CAST",
 "VARIABLE_IN_SINGLETON_WITHOUT_THREAD_LOCAL",
 "VARIABLE_WITH_REDUNDANT_INITIALIZER",
 "REDUNDANT_ELSE_IN_WHEN")

package j2kt

import javaemul.lang.*
import java.lang.RuntimeException
import java.util.Optional
import java.util.function.Function
import javaemul.lang.MutableListJvm
import kotlin.Any
import kotlin.Comparator
import kotlin.String
import kotlin.Suppress
import kotlin.collections.MutableIterable
import kotlin.jvm.JvmStatic

open class NullabilityInferenceProblem internal constructor() {
 companion object {
  @JvmStatic
  private fun <E: Any> sortedCopyOf(comparator: Comparator<in E>, elements: MutableIterable<E>): ImmutableList<E> {
   throw RuntimeException()
  }

  @JvmStatic
  private fun <T: Any> checkNotNull(reference: T?): T {
   throw RuntimeException()
  }

  @JvmStatic
  private fun testImplicitTypeArguments(users: MutableIterable<User>): ImmutableList<User> {
   return NullabilityInferenceProblem.sortedCopyOf<User>(
    java.util.Comparator.comparing<User, String>(
     Function { user: User ->
      return@Function user.getName().orElse("")!!
     } as Function<in User, out String>,
    ),
    users,
   )
  }

  @JvmStatic
  private fun testExplicitTypeArguments(users: MutableIterable<User>): ImmutableList<User> {
   return NullabilityInferenceProblem.sortedCopyOf<User>(
    java.util.Comparator.comparing<User, String>(
     Function { user: User ->
      return@Function user.getName().orElse("")!!
     } as Function<in User, out String>,
    ),
    users,
   )
  }

  @JvmStatic
  private fun testCheckNotNull(users: MutableIterable<User>): ImmutableList<User> {
   return NullabilityInferenceProblem.sortedCopyOf<User>(
    java.util.Comparator.comparing<User, String>(
     Function { user: User ->
      return@Function NullabilityInferenceProblem.checkNotNull<String>(
       user.getName().orElse("")!!,
      )
     } as Function<in User, out String>,
    ),
    users,
   )
  }
 }

 interface ImmutableList<T: Any>: MutableListJvm<T>

 fun interface User {
  fun getName(): Optional<String>
 }
}
