[ https://issues.apache.org/jira/browse/GROOVY-10371?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Eric Milles updated GROOVY-10371: --------------------------------- Language: groovy > STC involves improper subtyping rules for parameterized types with wildcard > types > --------------------------------------------------------------------------------- > > Key: GROOVY-10371 > URL: https://issues.apache.org/jira/browse/GROOVY-10371 > Project: Groovy > Issue Type: Bug > Components: Static Type Checker > Reporter: Thodoris Sotiropoulos > Assignee: Eric Milles > Priority: Minor > > The following program should not type check > {code:java} > class A<T> {} > class B<T> extends A<T> {} > class Test { > B<? extends Number> x = new B<Double>(); > A<Number> y = x; > } > {code} > h3. Expected behaviour > the compiler should have rejected the program and produced an error of the > form (like javac does): > {code} > error: incompatible types: B<CAP#1> cannot be converted to A<Number> > A<Number> y = x; > ^ > where CAP#1 is a fresh type-variable: > CAP#1 extends Number from capture of ? extends Number > 1 error > {code} > Tested against master -- This message was sent by Atlassian Jira (v8.20.10#820010)