You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Paul King (JIRA)" <ji...@apache.org> on 2018/07/12 11:52:00 UTC
[jira] [Updated] (GROOVY-8639) @Sortable annotation is not able to
use accessible parent properties
[ https://issues.apache.org/jira/browse/GROOVY-8639?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Paul King updated GROOVY-8639:
------------------------------
Description:
The @Sortable annotation does not appear to support sorting by parent properties, e.g.
{noformat}
Error:(22, 5) Groovyc: Error during @Sortable processing: tried to include unknown property 'name'
{noformat}
Example:
{code}
import groovy.transform.Sortable
import groovy.transform.ToString
class SortableSpec {
static void main(String[] args) {
new SortableSpec().run()
}
void run() {
Random random = Random.newInstance()
(0..9).collect {
new Thing(name: "${random.nextDouble()}")
}.sort().each { println it }
}
static class Base {
String name
}
// @Sortable(includes = 'name') <- fails compilation
@Sortable
@ToString(includeSuperProperties = true)
final static class Thing extends Base {}
}
{code}
was:
The @Sortable annotation does not appear to support sorting by parent properties, e.g.
{{Error:(22, 5) Groovyc: Error during @Sortable processing: tried to include unknown property 'name'}}
Example:
{{import groovy.transform.Sortable}}
{{import groovy.transform.ToString}}
{{class SortableSpec {}}
{{ static void main(String[] args) {}}
{{ new SortableSpec().run()}}
{{ }}}
{{ void run() {}}
{{ Random random = Random.newInstance()}}
{{ (0..9).collect {}}
{{ new Thing(name: "${random.nextDouble()}")}}
{{ }.sort().each \{ println it }}}
{{ }}}
{{ static class Base {}}
{{ String name}}
{{ }}}
{{ // @Sortable(includes = 'name') <- fails compilation}}
{{ @Sortable}}
{{ @ToString(includeSuperProperties = true)}}
{{ final static class Thing extends Base {}}}
{{}}}
> @Sortable annotation is not able to use accessible parent properties
> --------------------------------------------------------------------
>
> Key: GROOVY-8639
> URL: https://issues.apache.org/jira/browse/GROOVY-8639
> Project: Groovy
> Issue Type: Bug
> Components: groovy-runtime
> Affects Versions: 2.4.12
> Environment: Linux 4.16.7 x86_64
> Java(TM) SE Runtime Environment (build 1.8.0_172-b11)
> Reporter: Gus Power
> Priority: Minor
> Attachments: SortableSpec.groovy
>
>
> The @Sortable annotation does not appear to support sorting by parent properties, e.g.
> {noformat}
> Error:(22, 5) Groovyc: Error during @Sortable processing: tried to include unknown property 'name'
> {noformat}
> Example:
> {code}
> import groovy.transform.Sortable
> import groovy.transform.ToString
> class SortableSpec {
> static void main(String[] args) {
> new SortableSpec().run()
> }
> void run() {
> Random random = Random.newInstance()
> (0..9).collect {
> new Thing(name: "${random.nextDouble()}")
> }.sort().each { println it }
> }
> static class Base {
> String name
> }
> // @Sortable(includes = 'name') <- fails compilation
> @Sortable
> @ToString(includeSuperProperties = true)
> final static class Thing extends Base {}
> }
> {code}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)