Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-10365

STC does not perform boxing when overriding method using a parameterized class with bounded type parameters

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 4.0.3
    • Static Type Checker
    • None

    Description

      I have the following program

      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);
        }
      }
      

      Actual behaviour

      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
      

      Expected behaviour

      Compile successfully

      Tested against master.

      Attachments

        Activity

          People

            emilles Eric Milles
            theosot Thodoris Sotiropoulos
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: