Details
-
Wish
-
Status: Closed
-
Trivial
-
Resolution: Fixed
-
9.0
-
None
-
None
-
New
Description
Can we lift the restriction on using 'var' on the main branch? I know it's a double-edged sword and sometimes it leads to unreadable code, especially when you invoke a method, for example:
var foo = myMethodThatDoesSomething();
but in many, many, many cases the var keyword shortens the code and the type is obvious from the context. This happens in loops, try-with-resources and local variables.
for (var it = array.iterator(); it.hasNext();) { ... } try (var foo = new MyFoo()) { ... }
I'd say - let's allow vars (and other language features) and use common sense. If something is not clear in the context, type the variable. If something is obvious, use shortcuts.
Attachments
Issue Links
- is related to
-
SOLR-13671 Remove check for bare "var" declarations in validate-source-patterns in before releasing Solr 9.0
- Closed
- links to