Hi all,
while usage of Java 11 specific API has started to trickle into the
codebase already, for example, usage of List.of to build immutable lists.

However, there is a language feature that I still haven't seen usage of, so
far: "var", aka
local variable type inference.

A good article about is here:
https://belief-driven-design.com/local-variable-type-inference-java-10-91bf1586632/

Personally, I'm so used to the type declaration that I don't mind, but for
simple cases, I would not mind seeing "var" either. What would bother me,
on the other hand, would be to look at code assigning the result of a
method to a local variable, and not knowing what the type is, without also
having to go look at the signature of such method (somewhere else).

The other bit that I'm not particularly fond of is something like:

var myList = new ArrayList<String>();

because myList is now an ArrayList, not a List<String>... which would
imply, that autocomplete
would suggest more methods that originally intended, reducing the ability
to switch implementations later. The author says, as long as it's confined
to local variables, it's not too bad. Indeed, but how many make the IDE
generate a new method signature by a sample invocation? I do  a lot, which
would make the implementations trickle down there as well, if one does not
pay attention.

Seems to me a "use with good judgement" feature (they all are, but this one
seems tricky and involves personal views on when a target type is "obvious"
vs not so).

Opinions?

Cheers
Andrea

==
GeoServer Professional Services from the experts!

Visit http://bit.ly/gs-services-us for more information.
==

Ing. Andrea Aime
@geowolf
Technical Lead

GeoSolutions Group
phone: +39 0584 962313

fax:     +39 0584 1660272

mob:   +39  339 8844549

https://www.geosolutionsgroup.com/

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