You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by GitBox <gi...@apache.org> on 2018/07/29 23:49:08 UTC
[GitHub] leventov commented on a change in pull request #6068: Prohibit
Lists.newArrayList() with a single argument
leventov commented on a change in pull request #6068: Prohibit Lists.newArrayList() with a single argument
URL: https://github.com/apache/incubator-druid/pull/6068#discussion_r205991987
##########
File path: indexing-service/src/main/java/io/druid/indexing/common/task/Tasks.java
##########
@@ -74,7 +73,8 @@
toBeAccumulated.add(interval);
} else {
compactIntervals.add(JodaUtils.umbrellaInterval(toBeAccumulated));
- toBeAccumulated = Lists.newArrayList(interval);
+ toBeAccumulated.clear();
Review comment:
It's hard to imagine that a method `umbrellaInterval()`, accepting an `Iterable` of `Interval`s and returning an `Interval`, a final immutable object (defined in a library) that stores just begin and end of the interval, to store or modify the `Iterable` argument. Also, as per "Effective Java", the responsibility for making defensive copies is on the method (API) implementation side, not on the caller side.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org