You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2017/12/22 07:15:00 UTC
[jira] [Commented] (GROOVY-8386) Final variable analysis broken
with try/catch/finally
[ https://issues.apache.org/jira/browse/GROOVY-8386?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16301054#comment-16301054 ]
ASF GitHub Bot commented on GROOVY-8386:
----------------------------------------
GitHub user paulk-asert opened a pull request:
https://github.com/apache/groovy/pull/646
GROOVY-8386/GROOVY-8094: Final variable analysis broken with try/catc…
…h/finally and if/then/else
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/paulk-asert/groovy fva
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/groovy/pull/646.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #646
----
commit be854b73091a1b284efb7682a19df843f09e6df5
Author: paulk <pa...@...>
Date: 2017-12-22T07:11:51Z
GROOVY-8386/GROOVY-8094: Final variable analysis broken with try/catch/finally and if/then/else
----
> Final variable analysis broken with try/catch/finally
> -----------------------------------------------------
>
> Key: GROOVY-8386
> URL: https://issues.apache.org/jira/browse/GROOVY-8386
> Project: Groovy
> Issue Type: Bug
> Components: Compiler
> Affects Versions: 2.5.x
> Reporter: Paul King
>
> In this code:
> {code}
> final begin
> try {
> begin = new Date()
> } finally {
> println 'done'
> }
> {code}
> The current error is:
> {noformat}
> The variable [begin] may be uninitialized
> {noformat}
> 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:
> {code}
> @Grab('org.spockframework:spock-core:1.1-groovy-2.4-SNAPSHOT')
> @GrabExclude('org.codehaus.groovy:groovy-all')
> import spock.lang.Specification
> class DummySpec extends Specification {
> def 'FVA when using Spock'() {
> given:
> final begin = new Date()
> cleanup:
> println 'done'
> }
> }
> {code}
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)