rishabhdaim commented on PR #2055: URL: https://github.com/apache/jackrabbit-oak/pull/2055#issuecomment-2648989331
@mbaedke the sonar complaints regarding [Remove this array creation and simply pass the elements.](https://sonarcloud.io/project/issues?pullRequest=2055&open=AZTa0NS6q1ntFmbx0i9k&id=org.apache.jackrabbit%3Ajackrabbit-oak) are due to fact that I am creating an array beforehand passing the variables to an method that accepts varargs. ``` public static <E> Iterable<E> chainedIterable(final Iterable<? extends E> a, final Iterable<? extends E> b) { return chainedIterable(new Iterable[] {a, b}); } ``` is calling ``` @SafeVarargs public static <E> Iterable<E> chainedIterable(final Iterable<? extends E>... iterables) { Objects.requireNonNull(iterables); return org.apache.commons.collections4.IterableUtils.chainedIterable(iterables); } ``` from same class i.e. **IterableUtils** in oak-commons. In case I don't create an array, I would be calling the caller method thus creating an infinite loop. ``` public static <E> Iterable<E> chainedIterable(final Iterable<? extends E> a, final Iterable<? extends E> b) { return chainedIterable(a, b); } ``` this is the same pattern used inside **_commons-collections4_**. One possible way to avoid is to call _**commons-collections4**_ api's from each method rather than delegating the call to _commons-collections4_ to a single method. ``` public static <E> Iterable<E> chainedIterable(final Iterable<? extends E> a, final Iterable<? extends E> b) { return org.apache.commons.collections4.IterableUtils.chainedIterable(a, b); } ``` -- 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: oak-dev-unsubscr...@jackrabbit.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org