[
https://issues.apache.org/jira/browse/GROOVY-9711?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Ted Lundqvist updated GROOVY-9711:
----------------------------------
Summary: @Sortable annotation always sorts by the parent properties (was:
@Sortable annotation always sorts by the parrent properties)
> @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
> Priority: Major
>
> Adding includeSuperProperties = false doesn't help either.
> If the @Sortable annotation is removed from the super-class the test passes.
> Example:
> import groovy.transform.Sortable
> import groovy.util.logging.Slf4j
> import org.junit.Test
> @Slf4j
> 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
> }
> }
--
This message was sent by Atlassian Jira
(v8.3.4#803005)