This is an automated email from the ASF dual-hosted git repository. sunlan pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/groovy.git
commit 387c54701a6321776fc2aa61b03bb9b8e76b12cc Author: Daniel Sun <[email protected]> AuthorDate: Sat May 11 21:27:12 2019 +0800 Trivial refactoring: Remove redundant condition(closes #927) --- src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java b/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java index afc3fb4..d4a7479 100644 --- a/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java +++ b/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java @@ -7579,10 +7579,11 @@ public class DefaultGroovyMethods extends DefaultGroovyMethodsSupport { * * @return a new eager or lazy list of the values at the given indices */ + @SuppressWarnings("unchecked") public static <T> List<T> getAt(ListWithDefault<T> self, Collection indices) { List<T> answer = ListWithDefault.newInstance(new ArrayList<T>(indices.size()), self.isLazyDefaultValues(), self.getInitClosure()); for (Object value : indices) { - if (value instanceof Range || value instanceof Collection) { + if (value instanceof Collection) { answer.addAll((List<T>) InvokerHelper.invokeMethod(self, "getAt", value)); } else { int idx = normaliseIndex(DefaultTypeTransformation.intUnbox(value), self.size()); @@ -7667,10 +7668,11 @@ public class DefaultGroovyMethods extends DefaultGroovyMethodsSupport { * @return a new list of the values at the given indices * @since 1.0 */ + @SuppressWarnings("unchecked") public static <T> List<T> getAt(List<T> self, Collection indices) { List<T> answer = new ArrayList<T>(indices.size()); for (Object value : indices) { - if (value instanceof Range || value instanceof Collection) { + if (value instanceof Collection) { answer.addAll((List<T>)InvokerHelper.invokeMethod(self, "getAt", value)); } else { int idx = DefaultTypeTransformation.intUnbox(value);
