Fewer nullable types in Java APIs?


I like the T? types and the syntactic sugar compared to Scala's Option[T], but it's using them by default with Java APIs, even when a null value is impossible. The result is more ?. and !! in my code than is necessary, and I'm wondering... is there any interest in a feature where the compiler uses an optional input file (not sure the exact format) that would, in effect, add the @NotNull annotation to Java libraries (core or 3rd party), whose source code you can't modify?  It seems this could make the Java libs feel more like they were written with Kotlin in mind.



Please see this page: http://blog.jetbrains.com/kotlin/using-external-annotations/ and this one: http://blog.jetbrains.com/kotlin/2013/03/kannotator-0-1-is-out/

Our experience shows that this approach does not yield sufficiently good results, so we are working on a better solution that does not require !! for Java types at all


Sweet, thanks! That first link is exactly what I wanted.