Skip to content
Advertisement

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

There are many arguments in my code which can take the value null. It would be helpful if there is a @Nullable and @NonNull annotation like the ones offered in Android via Annotation.

Is there an alternative available in Harmony OS?

Advertisement

Answer

You can use org.jetbrains.annotations.Nullable & org.jetbrains.annotations.NotNull annotations available from jetbrains dependency,

implementation ‘org.jetbrains:annotations:20.1.0’

Advertisement