[
https://issues.apache.org/jira/browse/GROOVY-10368?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Eric Milles resolved GROOVY-10368.
----------------------------------
Fix Version/s: 5.0.0-alpha-1
Resolution: Fixed
https://github.com/apache/groovy/commit/01bb08e069fca08af00442978c95cd4a39c36c5a
> STC fails to instantiate type variable when using diamond operator
> ------------------------------------------------------------------
>
> Key: GROOVY-10368
> URL: https://issues.apache.org/jira/browse/GROOVY-10368
> Project: Groovy
> Issue Type: Bug
> Components: Static Type Checker
> Reporter: Thodoris Sotiropoulos
> Assignee: Eric Milles
> Priority: Major
> Fix For: 5.0.0-alpha-1
>
>
> I have the following program
> {code:java}
> class A<T extends Number> {
> A(String x) {}
> }
> class B {
> void m(A<Integer> x) {}
> }
> class Test {
> void test() {
> B x = new B();
> x.m(new A<>(""));
> }
> }
> {code}
> h3. Actual behaviour
> {code}
> org.codehaus.groovy.control.MultipleCompilationErrorsException: startup
> failed:
> test.groovy: 14: [Static type checking] - Cannot call
> B#m(A<java.lang.Integer>) with arguments [A<# extends java.lang.Number>]
> @ line 14, column 5.
> x.m(new A<>(""));
> ^
> 1 error
> {code}
> h3. Expected behaviour
> Compile successfully
> Tested against master
> (https://github.com/apache/groovy/commit/cf2f77fb033a10d36c4db3a7ff07a2b04631afcf)
--
This message was sent by Atlassian Jira
(v8.20.1#820001)