Changes between Version 62 and Version 63 of j2p
- Timestamp:
- 05/14/24 11:36:33 (7 months ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
j2p
v62 v63 123 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 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() { ... } }}}. 125 {{{@Nonnull String val}}} or {{{@Nonnull String f() { ... } }}}. Java primitive types like {{{boolean}}} and {{{int}}} can never be null and do not need @Nonnull 126 126 127 127 Note that Nonnull is NOT inherited by subclasses. Therefore the annotation may have to be repeated in the derived classes.