groovy-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Paul King (JIRA)" <>
Subject [jira] [Created] (GROOVY-8386) Final variable analysis broken with try/catch/finally
Date Sun, 19 Nov 2017 12:26:00 GMT
Paul King created GROOVY-8386:

             Summary: Final variable analysis broken with try/catch/finally
                 Key: GROOVY-8386
             Project: Groovy
          Issue Type: Bug
            Reporter: Paul King

In this code:
final begin
try {
  begin = new Date()
} finally {
  println 'done'
The current error is:
The variable [begin] may be uninitialized
But this should only happen if begin is used in the catch or finally blocks or prior to the
first assignment.

This impacts Spock usage since it converts the following into something similar to above:
import spock.lang.Specification

class DummySpec extends Specification {
    def 'FVA when using Spock'() {
        final begin = new Date()

        println 'done'

This message was sent by Atlassian JIRA

View raw message