Hi,
looking at the build scrolling by, it's not hard to notice the Java
compiler warning about unchecked
conversions with generic types... they are pretty much everywhere.

So I've started experimenting on a branch, making the unchecked warning an
error (just like deprecation)
and fixing it. As usual, the idea would be to fix all warnings, large PR,
and then enable the check for good,
for everyone.

As with other cases, I'm taking a modest approach: fix what's easy to fix,
suppress the rest (there are a bunch
of cases that cannot be fixed, and many that I don't really know how to
fix, even after re-reading the Java tutorial
on generics).

While I was at it, I've noticed a lot of cases where using the diamond
operator could make the code more compact,
and in many cases, more readable (especially with the 80 columns limit
google-java-format imposes).
PMD has a check for that, so I've added it. With lots of old code, we have
a ton of declarations with type arguments
that can be replaced by generics. Using IntelliJ inspections it's not hard
to find and replace them all, and it can
be possibly automated with some regular expressions (something capturing
"new Identifier<type args here>".

I've did the cleanups on the first few modules in the build (up to, and
including, gt-metadata) and pushed them on this branch:
https://github.com/aaime/geotools/tree/qa_unchecked
and also made a draft PR for people to look at the diffs:
https://github.com/geotools/geotools/pull/3043

Opinions? Worried that big bad generics might come and bite you? (well yes,
they will)
Anyone interested in helping? (we can split by module, or even by project)

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

Reply via email to