nfsantos commented on code in PR #1435:
URL: https://github.com/apache/jackrabbit-oak/pull/1435#discussion_r1593718807


##########
oak-run-commons/src/main/java/org/apache/jackrabbit/oak/index/indexer/document/flatfile/pipelined/MongoRegexPathFilterFactory.java:
##########
@@ -170,9 +170,9 @@ static List<String> 
mergeIndexAndCustomExcludePaths(List<String> indexExcludedPa
             return indexExcludedPaths;
         }
 
-        var excludedUnion = new HashSet<>(indexExcludedPaths);

Review Comment:
   No specific reason, I'm still unsure about when to use var vs explicit type. 
In many cases keeping the type annotation makes the code more clear and does 
not significantly increase verbosity, for instance:
   ```
   var i = 1;
   
   int i = 1;
   ```
   The second option makes it clear that it is an int, while the first is 
ambiguous.
   
   In other cases, even if the type annotation is longer, I still somewhat 
prefer that it appears at least one time. For instance, here I feel it's better 
to use var:
   ```
   var bi = new DownloadPosition(batch[i].getModified(), batch[i].getId());
   ```
   Because the type is explicit on the right hand side.
   
   But here:
   ```
               FindIterable<NodeDocument> mongoIterable = dbCollection
                       .find(findQuery)
                       .sort(sortOrder);
   ```
   I think it's nicer to have the type annotation because the right hand side 
does not contain the type.
   
   But it's just my gut feeling of what seems more clear and easy to read, I'm 
not following any set of best-practices. It would be interesting to have a 
discussion about the use of var.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@jackrabbit.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to