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

Parameterless closure to SAM coercion causes NPE during instruction selection with STC

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.4.5
    • Fix Version/s: 2.4.6
    • Component/s: Static Type Checker
    • Labels:
      None
    • Environment:
      Java 1.8.0_60, OSX 10.10

      Description

      Coercion of parameterless closures (lazy eval blocks) to SAM type arguments results in an NPE during static type checking.

      Example:

      interface SamType {
          int sam()
      }
      
      int foo(SamType samt) {
          samt.sam()
      }
      
      @groovy.transform.TypeChecked
      void doFoo() {
          assert foo { -> 1 } == 1
      }
      
      doFoo()
      

      Results in:

      BUG! exception in phase 'instruction selection' in source unit 'ConsoleScript19' unexpected NullpointerException
      Caused by: java.lang.NullPointerException
      

        Attachments

          Activity

            People

            • Assignee:
              melix Cédric Champeau
              Reporter:
              shils Shil Sinha
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: