From notifications-return-13482-archive-asf-public=cust-asf.ponee.io@groovy.apache.org Mon Aug 6 14:27:05 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 9BDEE180676 for ; Mon, 6 Aug 2018 14:27:04 +0200 (CEST) Received: (qmail 97257 invoked by uid 500); 6 Aug 2018 12:27:03 -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 97248 invoked by uid 99); 6 Aug 2018 12:27:03 -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; Mon, 06 Aug 2018 12:27:03 +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 471DE1A2A0D for ; Mon, 6 Aug 2018 12:27:03 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -109.501 X-Spam-Level: X-Spam-Status: No, score=-109.501 tagged_above=-999 required=6.31 tests=[ENV_AND_HDR_SPF_MATCH=-0.5, KAM_ASCII_DIVIDERS=0.8, 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 bXglD7cMe3Z1 for ; Mon, 6 Aug 2018 12:27:02 +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 D1D335F4AA for ; Mon, 6 Aug 2018 12:27:01 +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 C7D0DE25B2 for ; Mon, 6 Aug 2018 12:27:00 +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 2A27D23F9B for ; Mon, 6 Aug 2018 12:27:00 +0000 (UTC) Date: Mon, 6 Aug 2018 12:27:00 +0000 (UTC) From: =?utf-8?Q?L=C3=B3r=C3=A1nt_Pint=C3=A9r_=28JIRA=29?= To: notifications@groovy.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (GROOVY-8732) @CompileStatic allows access to private field in parent class 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-8732?page=3Dcom.atlassi= an.jira.plugin.system.issuetabpanels:all-tabpanel ] L=C3=B3r=C3=A1nt Pint=C3=A9r updated GROOVY-8732: ---------------------------------- Summary: @CompileStatic allows access to private field in parent class = (was: @CompileStatic allows access to private ) > @CompileStatic allows access to private field in parent class > ------------------------------------------------------------- > > Key: GROOVY-8732 > URL: https://issues.apache.org/jira/browse/GROOVY-8732 > Project: Groovy > Issue Type: Bug > Components: Static compilation > Affects Versions: 2.4.15, 2.6.0-alpha-4, 3.0.0-alpha-3, 2.5.1 > Reporter: L=C3=B3r=C3=A1nt Pint=C3=A9r > Priority: Major > > {code} > import groovy.transform.CompileStatic > @CompileStatic > interface Thing { > void call() > } > @CompileStatic > class ThingImpl implements Thing { > void call() {} > } > @CompileStatic > class Parent { > private final ThingImpl thing > public Thing getThing() { null } > } > @CompileStatic > class Child extends Parent { > public void doSomething() { > thing.call() > } > } > {code} > Compile via: {{groovyc Example.groovy}}. > The line {{thing.call}} in {{Child.doSomething()}} calls {{getThing()}}, = but then ends up referring to the returned value according to the private f= ield's type from {{Parent}} ({{ThingImpl}}) instead of the actual returned = type ({{Thing}}). The private field from {{Parent}} (or its type) should no= t be visible to {{Child}} at all. > {code} > public void doSomething(); > descriptor: ()V > flags: (0x0001) ACC_PUBLIC > Code: > stack=3D1, locals=3D1, args_size=3D1 > 0: aload_0 > 1: invokevirtual #20 // Method Parent.getThing:(= )LThing; > 4: checkcast #22 // class ThingImpl > 7: invokevirtual #25 // Method ThingImpl.call:()= V > 10: aconst_null > 11: pop > 12: return > {code} > This is causing now problems for Gradle plugins compiled against Grade 4.= 9 or before trying to run on Gradle 4.9, because we've made a change to an = internal type (`ProjectInternal`) that ended up being referred to via this = bug in compiled and released code. See https://github.com/gradle/gradle/iss= ues/6027 -- This message was sent by Atlassian JIRA (v7.6.3#76005)