You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Eric Milles (Jira)" <ji...@apache.org> on 2021/10/30 19:00:00 UTC
[jira] [Assigned] (GROOVY-10310) STC is unable to call
parameterized function
[ https://issues.apache.org/jira/browse/GROOVY-10310?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Eric Milles reassigned GROOVY-10310:
------------------------------------
Assignee: Eric Milles
> STC is unable to call parameterized function
> --------------------------------------------
>
> Key: GROOVY-10310
> URL: https://issues.apache.org/jira/browse/GROOVY-10310
> Project: Groovy
> Issue Type: Bug
> Components: Static Type Checker
> Reporter: Thodoris Sotiropoulos
> Assignee: Eric Milles
> Priority: Major
>
> I have the following program
> {code:java}
> class A<T> {
> T f;
> A(T f) {
> this.f = f;
> }
> A() {}
> }
> class B<T> {}
> class Test {
> static <T> A<T> test(T x, B<? extends T> z) {
> return new A<>(x);
> }
> public static void main(String[] args) {
> var d = "d";
> test(d, new B<>());
> }
> }
> {code}
> h3. Actual behaviour
> {code}
> org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
> test.groovy: 20: [Static type checking] - Cannot call <T> Test#test(T, B<? extends java.lang.Object>) with arguments [java.lang.String, B<java.lang.Object extends T>]
> @ line 20, column 5.
> test(d, new B<>());
> ^
> 1 error
> {code}
> h3. Expected behaviour
> Compile successfully
> Tested against master
--
This message was sent by Atlassian Jira
(v8.3.4#803005)