| 122 | ==== @Nonnull |
| 123 | Java variables like {{{String val}}} can contain a null value, and functions like {{{String f() { ... } }}} can return null. Therefore they are translated to {{{val:Optional[str]}}} and {{{def f(self)->Optional[str]}}}. |
| 124 | You can annotate the java code with @Nonnull (from {{{javax.annotation.Nonnull}}}) to indicate the value/return value will not be null, like this |
| 125 | {{{@Nonnull String val}}} or {{{@Nonnull String f() { ... } }}}. |
| 126 | |
| 127 | Note that Nonnull is NOT inherited by subclasses. Therefore the annotation may have to be repeated in the derived classes. |
| 128 | |