In Java, now that it supports text blocks, you can do this:
@Schema(description = """
Line one.
Line two.
""")
public void someMethodName() { ... }
In Java, text blocks are compile-time constants and they automatically remove the indents. But in Kotlin, if you do this:
@Schema(description = """
Line one.
Line two.
""")
fun someMethodName() { ... }
you end up with unwanted spaces in front of each line. Unfortunately, you can't use trimMargin()
or trimIndent()
because they are not compile-time constants. Is there a way to make it look as nice in Kotlin as it does in Java?