Changes between Version 62 and Version 63 of j2p


Ignore:
Timestamp:
05/14/24 11:36:33 (7 months ago)
Author:
wouter
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • j2p

    v62 v63  
    123123Java 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]}}}.
    124124You 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() { ... } }}}.
     125{{{@Nonnull String val}}} or {{{@Nonnull String f() { ... } }}}. Java primitive types like {{{boolean}}} and {{{int}}} can never be null and do not need @Nonnull
    126126
    127127Note that Nonnull is NOT inherited by subclasses. Therefore the annotation may have to be repeated in the derived classes.