Summary: Kotlin has an experimental support for [JSR-305 custom nullability qualifiers](https://github.com/Kotlin/KEEP/blob/master/proposals/jsr-305-custom-nullability-qualifiers.md). Annotating Nullsafe in a special way makes kotlinc recognize it as such custom nullability qualifier and therefore treat types coming from Nullsafe Java classes **not** as platform types, but rather proper nonnull/nullable, which affects: 1. Generated bytecode (more thorough null-checks). 2. Type inference in the IDE. NOTE re: p.1: one might expect that with properly annotated Java code Kotlin would avoid inserting runtime checks. This is not how Kotlin-Java interop works - in reality Kotlin does even more runtime checking for Java code annotated as Nonull, which IMO is a good thing, since you can't trust Java anyway. Reviewed By: mityal Differential Revision: D21278440 fbshipit-source-id: d0598738amaster
parent
c2ec55fe37
commit
064b4786f1
Binary file not shown.
Loading…
Reference in new issue