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

STC reports wrong message when encoutering wildcard types

    XMLWordPrintableJSON

Details

    Description

      I have the following program

      class A<T> {
      }
      class B {
        A<? extends Object> test() {
          return test2();
        }
        A<? extends Object> test2() {
          return null;
        }
      }
      

      Actual behaviour

      org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
      test.groovy: 6: [Static type checking] - Incompatible generic argument types. Cannot assign A<?> to: A<? extends java.lang.Object>
       @ line 6, column 12.
             return test2();
                    ^1 error
      
      

      Expected behaviour

      Compile successfully

      Tested against master

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: