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 2020/09/05 10:09:00 UTC

[jira] [Resolved] (GROOVY-9711) @Sortable annotation always sorts by the parent properties

     [ https://issues.apache.org/jira/browse/GROOVY-9711?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Paul King resolved GROOVY-9711.
-------------------------------
    Fix Version/s: 3.0.6
                   4.0.0-alpha-1
         Assignee: Paul King
       Resolution: Fixed

Proposed PR merged. Thanks for raising the issue.

> @Sortable annotation always sorts by the parent properties
> ----------------------------------------------------------
>
>                 Key: GROOVY-9711
>                 URL: https://issues.apache.org/jira/browse/GROOVY-9711
>             Project: Groovy
>          Issue Type: Bug
>          Components: groovy-runtime
>    Affects Versions: 3.0.5
>         Environment: Windows 10 version 1809
> AdoptOpenJDK version 8.0.242.08
> Groovy 3.0.5
>            Reporter: Ted Lundqvist
>            Assignee: Paul King
>            Priority: Major
>             Fix For: 4.0.0-alpha-1, 3.0.6
>
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> Adding includeSuperProperties = false doesn't help either.
> If the @Sortable annotation is removed from the super-class the test passes.
> Example: 
> {code:groovy}
> import groovy.transform.Sortable
> import org.junit.Test
> class SortableTest {
>  @Sortable(includes = ["num"])
>  class SortableClass{
>  Integer num
>  }
>  @Sortable(includeSuperProperties = false, includes = ["str"])
>  class SortableChild extends SortableClass {
>  String str
>  }
>  @Test
>  void test(){
>  List<SortableChild> unsortedList = [new SortableChild([str: "B", num: 1]), new SortableChild([str: "A", num: 2])]
>  List<SortableChild> sortedList = unsortedList.toSorted()
>  assert sortedList[0].str == "A" //Fails here
>  }
> }{code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)