I’m glad you brought this up Stefan, I’d been meaning to raise this myself. var is valuable for hacking and scripting, but I think it is counterproductive for a codebase like ours, that is mostly read not written, and where this keyword creates inconsistencies in where information for navigating can be found. IDEs then try to fill this information in, leading to typesetting inconsistencies, and requiring your brain to parse the information from at least two places with different presentations. The fact they need to do this strongly questions the value the keyword offers IMO.
TL;DR: It is harder to explore code written with var, and this is what we should be optimising for in my opinion. So I would like to see its use heavily restricted, personally. > On 29 Oct 2024, at 17:13, Štefan Miklošovič <smikloso...@apache.org> wrote: > > Hello, > > this should give you an idea > > grep --include '*.java' -r 'var ' src/ test/ > > I think this is a new concept here which was introduced recently with support > of Java 11 / Java 17 after we dropped 8. > > What is your opinion? Are we free to use it wherever we want? I am quite > conservative in this area and I will most probably still use types as we know > them but maybe in tests we might relax it a little bit? Or production code > with "var" is totally fine too without any concerns? I think this should be > covered by the code style. > > Regards