From notifications-return-18417-archive-asf-public=cust-asf.ponee.io@groovy.apache.org Fri Oct 11 13:56:02 2019 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [207.244.88.153]) by mx-eu-01.ponee.io (Postfix) with SMTP id 033D2180656 for ; Fri, 11 Oct 2019 15:56:01 +0200 (CEST) Received: (qmail 44150 invoked by uid 500); 11 Oct 2019 13:56:01 -0000 Mailing-List: contact notifications-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 notifications@groovy.apache.org Received: (qmail 44131 invoked by uid 99); 11 Oct 2019 13:56:01 -0000 Received: from mailrelay1-us-west.apache.org (HELO mailrelay1-us-west.apache.org) (209.188.14.139) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 11 Oct 2019 13:56:01 +0000 Received: from jira-he-de.apache.org (static.172.67.40.188.clients.your-server.de [188.40.67.172]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id A6FB5E30A8 for ; Fri, 11 Oct 2019 13:56:00 +0000 (UTC) Received: from jira-he-de.apache.org (localhost.localdomain [127.0.0.1]) by jira-he-de.apache.org (ASF Mail Server at jira-he-de.apache.org) with ESMTP id 250407803DB for ; Fri, 11 Oct 2019 13:56:00 +0000 (UTC) Date: Fri, 11 Oct 2019 13:56:00 +0000 (UTC) From: "Daniel Sun (Jira)" To: notifications@groovy.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Resolved] (GROOVY-9244) Anonymous subclasses should cast their super-parameters MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/GROOVY-9244?page=3Dcom.atlassi= an.jira.plugin.system.issuetabpanels:all-tabpanel ] Daniel Sun resolved GROOVY-9244. -------------------------------- Resolution: Fixed The proposed PR was merged. Thanks! > Anonymous subclasses should cast their super-parameters > ------------------------------------------------------- > > Key: GROOVY-9244 > URL: https://issues.apache.org/jira/browse/GROOVY-9244 > Project: Groovy > Issue Type: Bug > Affects Versions: 2.4.7, 2.5.7 > Environment: I tried in GroovyConsole 2.4.7 and Groovy web consol= e 2.5.7 > Reporter: Bj=C3=B6rn Kautler > Assignee: Eric Milles > Priority: Major > Fix For: 3.0.0-rc-1 > > Time Spent: 1h 40m > Remaining Estimate: 0h > > Given this code: > {noformat} > import java.util.regex.Pattern > abstract class Groovy3 { > Groovy3(String s) { println "String" } > Groovy3(Pattern p) { println "Pattern" } > } > class Groovy4 extends Groovy3 { > Groovy4(String s) { super(s) } > Groovy4(Pattern p) { super(p) } > } > class Groovy5 extends Groovy3 { > Groovy5(String s) { super(s as String) } > Groovy5(Pattern p) { super(p as Pattern) } > } > class Groovy6 { > Groovy6(String s) { println "String" } > Groovy6(Pattern p) { println "Pattern" } > } > new Groovy3(null as String) { } > new Groovy4(null as String) > new Groovy5(null as String) > new Groovy6(null as String) > {noformat} > Groovy3ish and Groovy4 instantiation fail > Groovy5 and Groovy6 instantiation succeed and print {{String}}. > I did not find a way to make the Groovy3ish one work, except for doing it= the Groovy4 way, but no chance with an anonymous subclass. > From what I observed, I guess the anonymous subclass does it like Groovy4= but should do it like Groovy5 to properly select the super constructor. -- This message was sent by Atlassian Jira (v8.3.4#803005)