Repository: incubator-groovy Updated Branches: refs/heads/master 458524c42 -> 8f024f601
trivial refactor Project: http://git-wip-us.apache.org/repos/asf/incubator-groovy/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-groovy/commit/8f024f60 Tree: http://git-wip-us.apache.org/repos/asf/incubator-groovy/tree/8f024f60 Diff: http://git-wip-us.apache.org/repos/asf/incubator-groovy/diff/8f024f60 Branch: refs/heads/master Commit: 8f024f6011af70deb08e1c9f31d9d843947e120f Parents: 458524c Author: Paul King <pa...@asert.com.au> Authored: Mon May 25 14:33:15 2015 +1000 Committer: Paul King <pa...@asert.com.au> Committed: Mon May 25 14:33:15 2015 +1000 ---------------------------------------------------------------------- .../codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-groovy/blob/8f024f60/src/main/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java ---------------------------------------------------------------------- diff --git a/src/main/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java b/src/main/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java index 9328d75..36bb3f7 100644 --- a/src/main/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java +++ b/src/main/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java @@ -2412,6 +2412,7 @@ public class StaticTypeCheckingVisitor extends ClassCodeVisitorSupport { private void doInferClosureParameterTypes(final ClassNode receiver, final Expression arguments, final ClosureExpression expression, final MethodNode selectedMethod, final Expression hintClass, final Expression options) { List<ClassNode[]> closureSignatures = getSignaturesFromHint(expression, selectedMethod, hintClass, options); List<ClassNode[]> candidates = new LinkedList<ClassNode[]>(); + Parameter[] closureParams = expression.getParameters(); for (ClassNode[] signature : closureSignatures) { // in order to compute the inferred types of the closure parameters, we're using the following trick: // 1. create a dummy MethodNode for which the return type is a class node for which the generic types are the types returned by the hint @@ -2420,14 +2421,12 @@ public class StaticTypeCheckingVisitor extends ClassCodeVisitorSupport { // In practice, it could be done differently but it has the main advantage of reusing // existing code, hence reducing the amount of code to debug in case of failure. ClassNode[] inferred = resolveGenericsFromTypeHint(receiver, arguments, selectedMethod, signature); - Parameter[] closureParams = expression.getParameters(); if (signature.length == closureParams.length // same number of arguments || (signature.length == 1 && closureParams.length == 0) // implicit it || (closureParams.length > signature.length && inferred[inferred.length - 1].isArray())) { // vargs candidates.add(inferred); } } - Parameter[] closureParams = expression.getParameters(); if (candidates.size()>1) { Iterator<ClassNode[]> candIt = candidates.iterator(); while (candIt.hasNext()) {