0

I have an old Java function in an Android project that is annotated with @NonNull. A few years after the function was written another developer added a branch that returns null and forgot to remove the annotation. This was discovered a few months later - I'm surprised the compiler didn't stop that from happening.

What potential issues could this or a similar situation cause, if any? Could this undermine null-safety when interoperating with Kotlin?

Marsroverr
  • 556
  • 1
  • 6
  • 23

1 Answers1

0

It should cause a compile error. But if a null is passed into a not nullable kotlin value, it would eventually lead to a crash when someone tried to dereference it.

Gabe Sechan
  • 90,003
  • 9
  • 87
  • 127