Harmony OS 中 Nullable 和 NonNull 注释的替代方案是什么?

What is the alternative in Harmony OS for Nullable and NonNull annotations?

我的代码中有很多参数可以取空值。如果像 Android 中通过 Annotation.

提供的那样提供 @Nullable 和 @NonNull 注释,那将会很有帮助

Harmony 中是否有可用的替代方案OS?

您可以使用 org.jetbrains.annotations.Nullable & org.jetbrains.annotations.NotNull jetbrains 依赖项提供的注释,

实施'org.jetbrains:annotations:20.1.0'

您可以参考这个link并使用所有隐藏的android API

https://github.com/anggrayudi/android-hidden-api

从那里我将 android.annotation 包中存在的注释接口移植到我正在制作的 Harmony OS 库中。