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

STC reports wrong message when encoutering wildcard types

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    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

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

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

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment