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

Static compiler doesn't respect contravariant type tokens

    XMLWordPrintableJSON

Details

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

    Description

      @groovy.transform.CompileStatic
      class Thing {
      
        public <O> void contravariant(Class<? super O> type, O object) {}
        public <O> void invariant(Class<O> type, O object) {}  
        
        void m() {
          invariant(String, "foo")
          contravariant(String, "foo") // fails, can't find method
        }
      }
      

      Worked in rc-2, fails with 2.3.0 final. Haven't tested rc-4.

      Attachments

        Activity

          People

            blackdrag Jochen Theodorou
            ldaley Luke Daley
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: