Uploaded image for project: 'Clover'
  1. Clover
  2. CLOV-1490

Clover safeEval method is imcompatible with Groovy's @CompileStatic annotation

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Medium
    • 4.0.1
    • 3.3.0
    • Groovy
    • None
    • Groovy Version - 2.1.3
      Clover Version - 3.3.0
      Java Version - 1.7.0

    Description

      When trying to use Clover on a Groovy class that is marked @CompileStatic and it contains a null-safe operator (e.g. Bar bar = foo?.bar), then the groovyc compilation fails with the error:

      No such property: bar for class: java.lang.Object

      The error is that the generated

      $CLV_safeEval${code} method returns an Object instead of the type of the property. This then causes Groovy compiler to fail later.
      
      I've created a sample project that exhibits the problem at https://github.com/johnrengelman/clover-grooyv-compilestatic
      
      Simply run 

      ./gradlew test

      
      

      Attachments

        Activity

          People

            mparfianowicz Marek Parfianowicz
            41d7a72aec2c John Engelman
            Votes:
            2 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: