Changes between Version 74 and Version 75 of j2p


Ignore:
Timestamp:
05/16/24 10:42:59 (11 months ago)
Author:
wouter
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • j2p

    v74 v75  
    125125Java 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]}}}.
    126126You can annotate the java code with {{{@NonNull}}} (from {{{org.eclipse.jdt.annotation.NonNull}}}) to indicate the value/return value will not be null, like this
    127 {{{@NonNull String val}}} or {{{@NonNull String f() { ... } }}}. Java primitive types like {{{boolean}}} and {{{int}}} can never be null and do not need @{{{@NonNull}}}
     127{{{@NonNull String val}}} or {{{@NonNull String f() { ... } }}}. Java primitive types like {{{boolean}}} and {{{int}}} can never be null and do not need {{{@NonNull}}}
    128128
    129129The dependency needed for this is (unfortunately this annotation is not built in anymore in the JRE)
     
    144144
    145145{{{#!td style="background: #efe"
    146 @{{{@NonNull}}} can be used by the java compiler to do extra checks on your code. Eclipse uses this annotation by default, but you may need to enable or customize it in Preferences/Java/Compiler/Errors/Warnings and scroll down to "Null Analysis".
     146{{{@NonNull}}} can be used by the java compiler to do extra checks on your code. Eclipse uses this annotation by default, but you may need to enable or customize it in Preferences/Java/Compiler/Errors/Warnings and scroll down to "Null Analysis".
    147147}}}
    148148
    149149{{{#!td style="background: #fee"
    150 @{{{@NonNull}}} is NOT inherited by subclasses. Therefore @{{{@NonNull}}} has to be repeated in the derived classes.
     150{{{@NonNull}}} is NOT inherited by subclasses. Therefore {{{@NonNull}}} has to be repeated in the derived classes.
    151151}}}
    152152