Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 9744B200D0F for ; Thu, 14 Sep 2017 12:18:58 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 9671E1609CC; Thu, 14 Sep 2017 10:18:58 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id DDA0A1609CD for ; Thu, 14 Sep 2017 12:18:57 +0200 (CEST) Received: (qmail 17048 invoked by uid 500); 14 Sep 2017 10:18:55 -0000 Mailing-List: contact commits-help@groovy.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@groovy.apache.org Delivered-To: mailing list commits@groovy.apache.org Received: (qmail 17039 invoked by uid 99); 14 Sep 2017 10:18:55 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 14 Sep 2017 10:18:55 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 62CB1F5629; Thu, 14 Sep 2017 10:18:55 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: paulk@apache.org To: commits@groovy.apache.org Date: Thu, 14 Sep 2017 10:18:55 -0000 Message-Id: <019d3e9c7aa74d1cbc5cdd7f9119300b@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [1/2] groovy git commit: GROOVY-8247: AIOOBE in StaticTypeCheckingVisitor with SAM and explicit closure parameter (closes #600) archived-at: Thu, 14 Sep 2017 10:18:58 -0000 Repository: groovy Updated Branches: refs/heads/master 5cdfa18f0 -> a2eb41e34 GROOVY-8247: AIOOBE in StaticTypeCheckingVisitor with SAM and explicit closure parameter (closes #600) Project: http://git-wip-us.apache.org/repos/asf/groovy/repo Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/d02a2ddf Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/d02a2ddf Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/d02a2ddf Branch: refs/heads/master Commit: d02a2ddf017e2475d3c8ba2e4d5289952072a8d1 Parents: 5cdfa18 Author: paulk Authored: Thu Sep 14 19:38:17 2017 +1000 Committer: paulk Committed: Thu Sep 14 20:14:57 2017 +1000 ---------------------------------------------------------------------- .../stc/StaticTypeCheckingVisitor.java | 12 ++++--- .../groovy/transform/stc/Groovy8247Bug.groovy | 36 ++++++++++++++++++++ 2 files changed, 44 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/groovy/blob/d02a2ddf/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 7e38ac4..98aebd7 100644 --- a/src/main/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java +++ b/src/main/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java @@ -2419,20 +2419,24 @@ public class StaticTypeCheckingVisitor extends ClassCodeVisitorSupport { blockParameterTypes = extractTypesFromParameters(p); } } - for (int i=0; i getSignaturesFromHint(final ClosureExpression expression, final MethodNode selectedMethod, final Expression hintClass, final Expression options) { // initialize hints List closureSignatures; http://git-wip-us.apache.org/repos/asf/groovy/blob/d02a2ddf/src/test/groovy/transform/stc/Groovy8247Bug.groovy ---------------------------------------------------------------------- diff --git a/src/test/groovy/transform/stc/Groovy8247Bug.groovy b/src/test/groovy/transform/stc/Groovy8247Bug.groovy new file mode 100644 index 0000000..7488352 --- /dev/null +++ b/src/test/groovy/transform/stc/Groovy8247Bug.groovy @@ -0,0 +1,36 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package groovy.transform.stc + +class Groovy8247Bug extends StaticTypeCheckingTestCase { + void testClosureWithExplicitParamNoInferrableArguments() { + assertScript ''' + def runnable(Runnable r) { + r.run() + } + def foo() { + runnable { it -> // note explicit it + println it + } + } + foo() + ''' + } +}