From notifications-return-13609-archive-asf-public=cust-asf.ponee.io@groovy.apache.org Tue Aug 14 10:06:13 2018 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 [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id A870E18067E for ; Tue, 14 Aug 2018 10:06:12 +0200 (CEST) Received: (qmail 54802 invoked by uid 500); 14 Aug 2018 08:06:06 -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 54647 invoked by uid 99); 14 Aug 2018 08:06:06 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 14 Aug 2018 08:06:06 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id 64D6F1A2931 for ; Tue, 14 Aug 2018 08:06:06 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -110.301 X-Spam-Level: X-Spam-Status: No, score=-110.301 tagged_above=-999 required=6.31 tests=[ENV_AND_HDR_SPF_MATCH=-0.5, RCVD_IN_DNSWL_MED=-2.3, SPF_PASS=-0.001, USER_IN_DEF_SPF_WL=-7.5, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id oSLDm3EY_mi7 for ; Tue, 14 Aug 2018 08:06:05 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id 0D0245F492 for ; Tue, 14 Aug 2018 08:06:05 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 9822AE265F for ; Tue, 14 Aug 2018 08:06:03 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 3242F23FC2 for ; Tue, 14 Aug 2018 08:06:02 +0000 (UTC) Date: Tue, 14 Aug 2018 08:06:02 +0000 (UTC) From: "Paul King (JIRA)" To: notifications@groovy.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Closed] (GROOVY-6716) Cannot implement a trait via anonymous class MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/GROOVY-6716?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Paul King closed GROOVY-6716. ----------------------------- > Cannot implement a trait via anonymous class > -------------------------------------------- > > Key: GROOVY-6716 > URL: https://issues.apache.org/jira/browse/GROOVY-6716 > Project: Groovy > Issue Type: Improvement > Components: Compiler > Affects Versions: 2.3.0-beta-2 > Reporter: Dinko Srkoc > Assignee: Paul King > Priority: Major > Labels: traits > Fix For: 2.5.2 > > > It is currently not possible to implement a trait by using anonymous classes: > {code} > trait Foo { def foo() { 42 } } > new Foo() {} // compiler complains > {code} > The compiler message is: > {{You are not allowed to extend the interface 'Foo', use implements instead}} > This is not consistent with interfaces and abstract classes: > {code} > interface Foo { def foo() } > new Foo() { def foo() { 42 } } // this works > {code} > It would be nice, for consistency reasons if no other, if traits could be extended to support this feature. -- This message was sent by Atlassian JIRA (v7.6.3#76005)