arch4u-pmd icon indicating copy to clipboard operation
arch4u-pmd copied to clipboard

New rule: return empty collection, empty array or optional instead of null

Open dgroup opened this issue 3 years ago • 2 comments

dgroup avatar Feb 23 '22 18:02 dgroup

@dgroup, Please provide more details and examples in which cases the rule should be triggered. Does this rule mean “never return null from methods”?

dykov avatar Oct 20 '24 17:10 dykov

@dykov, For cases when method returns

  • array
  • collection
  • class that extends collection

we must use empty collection. For optional separate rule is required.

dgroup avatar Oct 21 '24 06:10 dgroup