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 45F40200C6F for ; Mon, 24 Apr 2017 16:29:14 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 44A4F160B8F; Mon, 24 Apr 2017 14:29:14 +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 8CF47160BA5 for ; Mon, 24 Apr 2017 16:29:13 +0200 (CEST) Received: (qmail 22610 invoked by uid 500); 24 Apr 2017 14:29:12 -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 22554 invoked by uid 99); 24 Apr 2017 14:29:12 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 24 Apr 2017 14:29:12 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id 48C46C028B for ; Mon, 24 Apr 2017 14:29:12 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -99.202 X-Spam-Level: X-Spam-Status: No, score=-99.202 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id DogXCfPm0rGT for ; Mon, 24 Apr 2017 14:29:11 +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 CEB8E5F5F9 for ; Mon, 24 Apr 2017 14:29:10 +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 D7658E0D5C for ; Mon, 24 Apr 2017 14:29:04 +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 3B3C221B5C for ; Mon, 24 Apr 2017 14:29:04 +0000 (UTC) Date: Mon, 24 Apr 2017 14:29:04 +0000 (UTC) From: "Paul King (JIRA)" To: notifications@groovy.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Comment Edited] (GROOVY-8127) Access to Trait$Trait$Helper#$self is forbidden MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Mon, 24 Apr 2017 14:29:14 -0000 [ https://issues.apache.org/jira/browse/GROOVY-8127?page=3Dcom.atlassia= n.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=3D159= 81225#comment-15981225 ]=20 Paul King edited comment on GROOVY-8127 at 4/24/17 2:28 PM: ------------------------------------------------------------ Proposed PR merged but additional feedback on the fix is welcome. Thanks fo= r raising the issue. was (Author: paulk): Proposed PR merged > Access to Trait$Trait$Helper#$self is forbidden > ----------------------------------------------- > > Key: GROOVY-8127 > URL: https://issues.apache.org/jira/browse/GROOVY-8127 > Project: Groovy > Issue Type: Bug > Components: Compiler > Affects Versions: 2.4.10 > Reporter: Fran=C3=A7ois Guillot > Assignee: Paul King > Fix For: 2.4.11 > > > I'm switching from Groovy 2.4.7 to 2.4.10 in my project. > I have a compile error with 2.4.10. > Simplified example: > {code} > import groovy.transform.CompileStatic > import org.junit.Rule > import org.junit.rules.TestRule > @CompileStatic > trait FooTrait { > @Rule > public final TestRule foo =3D {} as TestRule > } > {code} > I get "Error:Groovyc: Access to FooTrait$Trait$Helper#$self is forbidden" > Another variant of this error is "Error:Groovyc: Apparent variable '$self= ' > was found in a static scope but doesn't refer to a local variable, static > field or class." > This second error happens with the following code > {code} > import groovy.transform.CompileStatic > import org.junit.Rule > import org.junit.rules.TestRule > import org.junit.runner.Description > import org.junit.runners.model.Statement > @CompileStatic > trait TestSupport { > boolean failOnResourceLeak =3D true > @Rule > public final TestRule leakDetectionFlagRule =3D { Statement base, Des= cription description -> > return { > base.evaluate() > if (failOnResourceLeak) { > throw new Exception("A resource has leaked in this test!"= ) > } > } as Statement > } as TestRule > } > {code} -- This message was sent by Atlassian JIRA (v6.3.15#6346)