Empa
10/07/2026, 9:18 AMString!) from Kotlin, with an annotation or similar?
I'm making a regex helper where the result gets destructured, and i want the declared types specified for the named groups to decide nullability. for example:
regex.match(string, "group", "nullable") { (groupString, nullableString: String?) -> ... }
Where groupString would be String! and nullableString would be String? , and an NPE would be thrown if groupString ends up being nullable when used.
Right now, the only way I've managed to do this is by creating a helper function in java that returns the passed parameter without any nullability info. I would rather not rely on this method if there is a better way to do it, or is it not possible in pure Kotlin?CLOVIS
10/08/2026, 8:10 AM