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 04C86200CCA for ; Wed, 5 Jul 2017 02:32:48 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 03DC9162157; Wed, 5 Jul 2017 00:32:48 +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 491F5162152 for ; Wed, 5 Jul 2017 02:32:47 +0200 (CEST) Received: (qmail 21571 invoked by uid 500); 5 Jul 2017 00:32:46 -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 21562 invoked by uid 99); 5 Jul 2017 00:32:46 -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; Wed, 05 Jul 2017 00:32:46 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 752EEDFB94; Wed, 5 Jul 2017 00:32:45 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: jwagenleitner@apache.org To: commits@groovy.apache.org Message-Id: <1adfc945e17d46c1aa240fc031e1721d@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: groovy git commit: GROOVY-8240: Compilation error in @CompileStatic (closes #570) Date: Wed, 5 Jul 2017 00:32:45 +0000 (UTC) archived-at: Wed, 05 Jul 2017 00:32:48 -0000 Repository: groovy Updated Branches: refs/heads/master 44b89dab6 -> 8f6b7cdb7 GROOVY-8240: Compilation error in @CompileStatic (closes #570) Project: http://git-wip-us.apache.org/repos/asf/groovy/repo Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/8f6b7cdb Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/8f6b7cdb Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/8f6b7cdb Branch: refs/heads/master Commit: 8f6b7cdb7239e7e17b3fd42807558c0c85b50e3d Parents: 44b89da Author: alexey.afanasiev Authored: Thu Jun 29 16:27:38 2017 +0300 Committer: John Wagenleitner Committed: Tue Jul 4 15:24:05 2017 -0700 ---------------------------------------------------------------------- .../stc/StaticTypeCheckingVisitor.java | 2 +- .../classgen/asm/sc/bugs/Groovy8240Bug.groovy | 72 ++++++++++++++++++++ 2 files changed, 73 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/groovy/blob/8f6b7cdb/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 b7f00b6..7e38ac4 100644 --- a/src/main/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java +++ b/src/main/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java @@ -3814,7 +3814,7 @@ public class StaticTypeCheckingVisitor extends ClassCodeVisitorSupport { ); stubbed.setGenericsTypes(method.getGenericsTypes()); } - stubbed.setDeclaringClass(receiver); + stubbed.setDeclaringClass(method.getDeclaringClass()); result.add(stubbed); } } http://git-wip-us.apache.org/repos/asf/groovy/blob/8f6b7cdb/src/test/org/codehaus/groovy/classgen/asm/sc/bugs/Groovy8240Bug.groovy ---------------------------------------------------------------------- diff --git a/src/test/org/codehaus/groovy/classgen/asm/sc/bugs/Groovy8240Bug.groovy b/src/test/org/codehaus/groovy/classgen/asm/sc/bugs/Groovy8240Bug.groovy new file mode 100644 index 0000000..2dbb0e3 --- /dev/null +++ b/src/test/org/codehaus/groovy/classgen/asm/sc/bugs/Groovy8240Bug.groovy @@ -0,0 +1,72 @@ +/* + * 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 org.codehaus.groovy.classgen.asm.sc.bugs + +import groovy.transform.stc.StaticTypeCheckingTestCase +import org.codehaus.groovy.classgen.asm.sc.StaticCompilationTestSupport + +class Groovy8240Bug extends StaticTypeCheckingTestCase implements StaticCompilationTestSupport { + void testDefaultArguments() { + assertScript ''' + class Bar { + void vararg(boolean flag = true, Class... classes) {} + } + + class Foo extends Bar{ + def test() { + vararg(false, Foo) + } + } + + new Foo().test() + ''' + } + + void testDefaultArgumentsWith2Vararg() { + assertScript ''' + class Bar { + void vararg(boolean flag = true, Class... classes) {} + } + + class Foo extends Bar{ + def test() { + vararg(false, Foo, Bar) + } + } + + new Foo().test() + ''' + } + + void testDefaultArgumentsWithoutVararg() { + assertScript ''' + class Bar { + void vararg(boolean flag = true, Class... classes) {} + } + + class Foo extends Bar{ + def test() { + vararg(false) + } + } + + new Foo().test() + ''' + } +}