[ https://issues.apache.org/jira/browse/GROOVY-11189?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17779622#comment-17779622 ]
Eric Milles commented on GROOVY-11189: -------------------------------------- https://github.com/apache/groovy/commit/7a240549c04eabbf9e24138a9119e8ac3cade049 > STC LUB of List and Set is not Collection for Java 21 > ----------------------------------------------------- > > Key: GROOVY-11189 > URL: https://issues.apache.org/jira/browse/GROOVY-11189 > Project: Groovy > Issue Type: Bug > Components: Static Type Checker > Affects Versions: 5.0.0-alpha-2, 4.0.15 > Reporter: Eric Milles > Assignee: Eric Milles > Priority: Major > Fix For: 5.0.0-alpha-3, 4.0.16 > > > The new {{SequencedCollection}} interface introduced in Java 21 has altered > the type inference results for mixed use of {{List}} and {{Set}}. Consider > the following: > {code:groovy} > def x > x = [] as List > if (predicate()) { > x = [] as Set > } > x > {code} > Under STC, the inferred type of the last occurrence of "x" has changed from > {{Collection}} to {{Object}}. -- This message was sent by Atlassian Jira (v8.20.10#820010)