markiewb/nb-additional-hints

Convert return statement to use Optional.ofNullable(xxx)/Optional.of(xxx) in methods with Optional return type

markiewb opened this issue · 1 comments

Provide some fixes for return statements within methods with the return type java.util.Optional.

For example

  • return null will be transformed to return Optional.empty()
  • return xxx will be transformed to return Optional.of(xxx) or return Optional.ofNullable(xxx)

Merge hint with "Convert return null to return Optional.empty()"