此检查可识别被调用者可能为 null 的方法调用,有助于在运行时发生潜在的 NullPointerExceptions 之前检测到这些异常。
null
NullPointerExceptions
示例:
def sayHello(@Nullable greeting: String): Unit = { println(greeting.toLowerCase) }