Hi all,
the unchecked warnings cleanups is done, has just been merged in GeoServer, completing coverage in all
three projects.
Working on it, I leveraged IntelliJ inspections a lot to clean up the projects quicker. Now, I could not use
automatic cleanups for the unchecked warnings, but there are a number of low hanging fruit cleanups
that can be applied automatically, getting a good amount of cleanup for a small effort.
Among the many, a few examples:
- Unnecessary casts
- Unnecessary type variable information (usage of diamond)
- Usage of assertTrue/assertFalse when assertEquals/assertNotEquals would do
The ones above also have corresponding rules in PMD/SpotBugs, making them a good candidate for
inclusion in the QA profile (do you have any other suggestions?)
Today I started looking at unnecessary casts. The automatic cleanup does the heavy lifting, it’s not
perfect, requires some manual intervention post cleanup, but I managed to get all three projects
cleaned up in a matter of a couple hours. This included a PMD update and some associated
extra fixes, as the unnecessary cast rule has been added just recently.
Here are the PRs for it:
Moving forward, I think it would be nice to also leverage the IntelliJ automatic migrations, for example:
- Switch iterator loops to enhanced for loops
- Migrate JUnit 3 tests to Junit 4 tests (it won’t be possible to do it automatically for all, like the online tests)
For these I’m not sure we can do anything in terms of QA build enforcement, but also believe no one would write
code using Junit3 or iterators these days.
So… what do you think?
Cheers
Andrea
···
Regards, Andrea Aime
== 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.
I think that’s impressive and a big help in avoiding a lot of code rotting, big +1 from me, and a huge thanks for the “unchecked” work.
···
Gabriel Roldán
Hi all,
given the lack of negative comments, I’ll move on and merge during the weekend, and if time allows,
prepare another set of PRs for the “diamond” case
Cheers
Andrea
···
Regards, Andrea Aime
== 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.
Ok folks,
first batch (unnecessary casts) is in, second one, diamond operator, is on:
Given the low amount of feedback, I’m tempted to just merge when they become green, as it’s another direct
follow up from the unchecked warning cleanup.
Next in line would be cleaning up the iterators to enhanced for loop, for that I guess I’d wait a little more.
Cheers
Andrea
···
Regards, Andrea Aime
== 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.