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

SAM coercion doesn't work with abstract classes in @CompileStatic

    XMLWordPrintableJSON

Details

    Description

      import groovy.transform.CompileStatic
      
      abstract class A1 {
          def abstract foo()
      }
      
      @CompileStatic
      def m() {
          A1 a = { print this } //Groovyc: [Static type checking] - Cannot assign value of type groovy.lang.Closure <java.lang.Void> to variable of type A1
      }
      

      Looks like it should work as in dynamic mode.

      Attachments

        Activity

          People

            Unassigned Unassigned
            Alexey Afanasiev Alexey Afanasiev
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: