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 3C2C7200B6B for ; Thu, 25 Aug 2016 14:34:22 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 3AB26160A94; Thu, 25 Aug 2016 12:34:22 +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 82070160A93 for ; Thu, 25 Aug 2016 14:34:21 +0200 (CEST) Received: (qmail 1718 invoked by uid 500); 25 Aug 2016 12:34:20 -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 1700 invoked by uid 99); 25 Aug 2016 12:34:20 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 25 Aug 2016 12:34:20 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id 854E92C0032 for ; Thu, 25 Aug 2016 12:34:20 +0000 (UTC) Date: Thu, 25 Aug 2016 12:34:20 +0000 (UTC) From: "ASF GitHub Bot (JIRA)" To: notifications@groovy.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (GROOVY-5396) Groovy classes can't see package-local properties from a super class MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Thu, 25 Aug 2016 12:34:22 -0000 [ https://issues.apache.org/jira/browse/GROOVY-5396?page=3Dcom.atlassia= n.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=3D154= 36760#comment-15436760 ]=20 ASF GitHub Bot commented on GROOVY-5396: ---------------------------------------- GitHub user paulk-asert opened a pull request: https://github.com/apache/groovy/pull/396 GROOVY-5396: Groovy classes can't see package-local properties from a= =E2=80=A6 =E2=80=A6 super class You can merge this pull request into a Git repository by running: $ git pull https://github.com/paulk-asert/groovy groovy5396 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/groovy/pull/396.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #396 =20 ---- commit ef76efce7aa71f1e4c01cbaaa37a2f62a2fb0f3a Author: paulk Date: 2016-08-25T12:32:23Z GROOVY-5396: Groovy classes can't see package-local properties from a s= uper class ---- > Groovy classes can't see package-local properties from a super class > -------------------------------------------------------------------- > > Key: GROOVY-5396 > URL: https://issues.apache.org/jira/browse/GROOVY-5396 > Project: Groovy > Issue Type: Bug > Components: Compiler > Affects Versions: 2.0-beta-1, 1.8.6 > Reporter: Tim Yates > Attachments: FailingAbstractSuper.tgz > > > If I have a standard gradle project setup (attached): > {code} > build.gradle > src/ > main/ > java/ > test/ > AbstractBase.java > SamePackageJavaBase.java > groovy/ > test/ > GroovyBase.groovy > GroovyBaseWithSuper.groovy > {code} > I have a single Abstract base class: > {code:title=3DAbstractBase.java} > package test ; > public abstract class AbstractBase { > int base ; > public AbstractBase( int base ) { > this.base =3D base ; > } > public abstract int mult( int n ) ; > } > {code} > And a class {{GroovyBase}} that extends this class: > {code:title=3DGroovyBase.groovy} > package test > public class GroovyBase extends AbstractBase { > public GroovyBase( int n ) { > super( n ) > } > public int mult( int n ) { > n * base > } > static main( args ) { > println new GroovyBase( 10 ).mult( 3 ) > } > } > {code} > When running this (using the Gradle script in the attachment), I get the = exception: > {code} > Exception in thread "main" groovy.lang.MissingPropertyException: No such = property: base for class: test.GroovyBase > Possible solutions: class > {code} > Changing the line > {code} > n * base > {code} > to > {code} > n * super.base > {code} > Or making the {{base}} field public in the {{AbstractBase}} class makes i= t work. > It's as if the classes are considered to be in different packages for som= e things, but not for others. > Thinking about it, not sure if this is a Gradle bug or a Groovy cross com= piler one. > To run the tests, unpack the attachment, and run: > {code} > # Test the above failing example > gradle -Pmain=3Dtest.GroovyBase > # Test the addition of super.base > gradle -Pmain=3Dtest.GroovyBaseWithSuper > # Test the Java extension of the Abstract class > gradle -Pmain=3Dtest.SamePackageJavaBase > {code} > You can change the groovy version from 1.8.6 by passing (for example) {{-= Pgroovy=3Dgroovy=3D2.0.0-beta-2}} -- This message was sent by Atlassian JIRA (v6.3.4#6332)