You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2017/11/16 13:44:00 UTC
[jira] [Commented] (GROOVY-8382) Target Typing for empty
collections should work for field/property initialisers
[ https://issues.apache.org/jira/browse/GROOVY-8382?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16255325#comment-16255325 ]
ASF GitHub Bot commented on GROOVY-8382:
----------------------------------------
GitHub user paulk-asert opened a pull request:
https://github.com/apache/groovy/pull/637
GROOVY-8382: Target Typing for empty collections should work for fiel…
…d/property initialisers
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/paulk-asert/groovy groovy8382
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/groovy/pull/637.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 #637
----
commit 40f1b2953472fdb20bd1fc35ec26b3d435d6a72b
Author: paulk <pa...@asert.com.au>
Date: 2017-11-16T13:40:14Z
GROOVY-8382: Target Typing for empty collections should work for field/property initialisers
----
> Target Typing for empty collections should work for field/property initialisers
> -------------------------------------------------------------------------------
>
> Key: GROOVY-8382
> URL: https://issues.apache.org/jira/browse/GROOVY-8382
> Project: Groovy
> Issue Type: Bug
> Reporter: Paul King
>
> {code}
> import groovy.transform.*
> @CompileStatic
> @ToString(includeFields=true)
> class Foo {
> List<String> propWithGen = ['propWithGen'] ?: []
> List propNoGen = ['propNoGen'] ?: []
> private List<String> fieldGen = ['fieldGen'] ?: []
> def bar() {
> this.propNoGen = ['notDecl'] ?: [] // not applicable here
> List<String> localVar = ['localVar'] ?: []
> localVar
> }
> }
> def foo = new Foo()
> assert foo.bar() == ['localVar']
> assert foo.toString() == 'Foo([propWithGen], [notDecl], [fieldGen])'
> {code}
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)