Is there any way to write a "static" (i.e. compani...
# getting-started
j
Is there any way to write a "static" (i.e. companion object) extension fun or val for a Java class? I want to write something like
Copy code
import java.time.Duration

private val durationMax: Duration = Duration.ofSeconds(Long.MAX_VALUE)
val Duration.Companion.MAX: Duration
    get() = durationMax
but there's no
java.time.Duration.Companion
of course. Is there a decent idiomatic equivalent way to do this?
I could of course just make the
val durationMax
public but it doesn't feel as idiomatic, especially since ktlint won't let me capitalize it.
c