问题 Notice: As of Scala 2.11, NotNull is deprecated. As far as I understand, if you want a reference type to be non-nullable you have to mixin the magic NotNull trait, and the compiler will automatically prevent you from putting null -able values in it. See this mailing-list thread for instance. What lacking is, a decent library support for non-nullable types. If I would like to write a package that don't need to interface java code directly, and I want to prevent all types in this package from