On Sat, Jun 12, 2021 at 12:31 PM Roar Brænden <roar.brenden...@gmail.com> wrote:
> Hi, > Looking at that last method, I counted seven «return null». > Is there a PMD for replacing «return null» with Optional? > I don't know.. but that would be an API break. So it needs the usual cycle of deprecation, replacement, removal after a release. Also, it must not be subject to a dumb automatic check, there is a lot of discussion on the net about usage of Optionals, inlcuding a list of places where they should not be used... a few of interesting refences: - https://medium.com/@yassinhajaj/optionals-are-bad-practices-still-bad-practices-if-everyone-practices-them-6ec5a66c30aa - https://dzone.com/articles/using-optional-correctly-is-not-optional In the specific case of GeoTools, using Optionals should be taken with extra care, as we have parts of the API called millions of times, adding the allocation of millions of wrappers causes significant overhead (as we have learned the hard and painful way with the JTS Coordinate class). Cheers Andrea == GeoServer Professional Services from the experts! Visit http://goo.gl/it488V for more information. == Ing. Andrea Aime @geowolf Technical Lead GeoSolutions S.A.S. Via di Montramito 3/A 55054 Massarosa (LU) phone: +39 0584 962313 fax: +39 0584 1660272 mob: +39 339 8844549 http://www.geo-solutions.it http://twitter.com/geosolutions_it ------------------------------------------------------- *Con riferimento alla normativa sul trattamento dei dati personali (Reg. UE 2016/679 - Regolamento generale sulla protezione dei dati “GDPR”), si precisa che ogni circostanza inerente alla presente email (il suo contenuto, gli eventuali allegati, etc.) è un dato la cui conoscenza è riservata al/i solo/i destinatario/i indicati dallo scrivente. Se il messaggio Le è giunto per errore, è tenuta/o a cancellarlo, ogni altra operazione è illecita. Le sarei comunque grato se potesse darmene notizia. This email is intended only for the person or entity to which it is addressed and may contain information that is privileged, confidential or otherwise protected from disclosure. We remind that - as provided by European Regulation 2016/679 “GDPR” - copying, dissemination or use of this e-mail or the information herein by anyone other than the intended recipient is prohibited. If you have received this email by mistake, please notify us immediately by telephone or e-mail.*
_______________________________________________ GeoTools-Devel mailing list GeoTools-Devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geotools-devel