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

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

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

      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

      
      

            [CLOV-1490] Clover safeEval method is imcompatible with Groovy's @CompileStatic annotation

            Owen made changes -
            Workflow Original: New Clover Workflow [ 898131 ] New: New Clover Workflow - Restricted [ 1474502 ]
            Piotr Swiecicki made changes -
            Workflow Original: Clover Workflow [ 896445 ] New: New Clover Workflow [ 898131 ]
            Piotr Swiecicki made changes -
            Workflow Original: reviewflow [ 681479 ] New: Clover Workflow [ 896445 ]
            Marek Parfianowicz made changes -
            Status Original: Resolved [ 5 ] New: Closed [ 6 ]
            Marek Parfianowicz made changes -
            Resolution New: Fixed [ 1 ]
            Status Original: To be reviewed [ 10026 ] New: Resolved [ 5 ]
            Marek Parfianowicz made changes -
            Attachment New: grails-clover-4.0.1-pre-release.ZIP [ 126586 ]
            Marek Parfianowicz made changes -
            Status Original: In Progress [ 3 ] New: To be reviewed [ 10026 ]
            Marek Parfianowicz made changes -
            Remote Link New: This issue links to "Clover › All Ant Groovy Tests › CLOV-1490_safeeval_and_compilestatic (devtools-bamboo)" [ 75354 ]
            Marek Parfianowicz made changes -
            Status Original: Open [ 1 ] New: In Progress [ 3 ]
            Marek Parfianowicz made changes -
            Story Points New: 3

              mparfianowicz Marek Parfianowicz
              41d7a72aec2c John Engelman
              Affected customers:
              2 This affects my team
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: