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/11/12 12:10:00 UTC

[jira] [Created] (GROOVY-10365) STC does not perform boxing when overriding method using a parameterized class with bounded type parameters

Thodoris Sotiropoulos created GROOVY-10365:
----------------------------------------------

             Summary: STC does not perform boxing when overriding method using a parameterized class with bounded type parameters
                 Key: GROOVY-10365
                 URL: https://issues.apache.org/jira/browse/GROOVY-10365
             Project: Groovy
          Issue Type: Bug
          Components: Static Type Checker
            Reporter: Thodoris Sotiropoulos


I have the following program

{code:java}
interface I {
  double m(Integer x);
}

class A<T extends Number, Y> implements I {
  public double m(Integer x) {
    return 10.0;
  }
}

class B<T extends I> {
  public int f;

  double m2(A<Float, ? extends T> x) {
    return x.m(f);
  }
}
{code}

h3. Actual behaviour

{code}
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
test.groovy: 15: [Static type checking] - Cannot call A#m(java.lang.Integer) with arguments [int]
 @ line 15, column 12.
       return x.m(f);
              ^

1 error
{code}

h3. Expected behaviour

Compile successfully

Tested against master.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)