Eric Milles created GROOVY-11189:
------------------------------------

             Summary: 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
            Reporter: Eric Milles


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)

Reply via email to