You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Thodoris Sotiropoulos (Jira)" <ji...@apache.org> on 2021/10/05 07:23:00 UTC

[jira] [Created] (GROOVY-10283) Cannot assign type parameter whose bound is a parameterized type that takes a wildcard

Thodoris Sotiropoulos created GROOVY-10283:
----------------------------------------------

             Summary: Cannot assign type parameter whose bound is a parameterized type that takes a wildcard
                 Key: GROOVY-10283
                 URL: https://issues.apache.org/jira/browse/GROOVY-10283
             Project: Groovy
          Issue Type: Bug
          Components: Static Type Checker
            Reporter: Thodoris Sotiropoulos


I have the following program

{code:java}
class A<T1, T2> {}

class B<T1 extends Number, T2 extends A<C, ? extends T1>> {
  T2 f;

  B(T2 f) {
    this.f  = f;
  }
}

class C {}
{code}

h3. Actual behavior

{code}
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
test.groovy: 7: [Static type checking] - Cannot assign value of type A<C, ? extends java.lang.Number<T1 extends java.lang.Number>> to variable of type T2
 @ line 7, column 15.
       this.f  = f;
                 ^

1 error
{code}

h3. Expected behavior
Compile successfully

Tested against master





--
This message was sent by Atlassian Jira
(v8.3.4#803005)