[ 
https://issues.apache.org/jira/browse/GROOVY-7248?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15875026#comment-15875026
 ] 

ASF GitHub Bot commented on GROOVY-7248:
----------------------------------------

GitHub user jwagenleitner opened a pull request:

    https://github.com/apache/groovy/pull/501

    GROOVY-7248: MissingPropertyException: No such property in finally block

    

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/jwagenleitner/groovy groovy7248

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/groovy/pull/501.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 #501
    
----
commit 52e6a5b435651050d978260381496530b79eab1d
Author: John Wagenleitner <[email protected]>
Date:   2017-02-20T15:52:13Z

    GROOVY-7248: MissingPropertyException: No such property in finally block

----


> MissingPropertyException: No such property in finally block
> -----------------------------------------------------------
>
>                 Key: GROOVY-7248
>                 URL: https://issues.apache.org/jira/browse/GROOVY-7248
>             Project: Groovy
>          Issue Type: Bug
>    Affects Versions: 2.3.9, 2.4.1
>         Environment: Groovy Version: 2.3.9
> JVM: 1.8.0_20 Vendor: Oracle Corporation
> OS: Mac OS X
>            Reporter: Neeme Praks
>         Attachments: Groovy7248Bug.groovy
>
>
> Given the following Groovy program:
> {code}
> class Test {
>   void run() {
>     long start = 0;
>     try {
>       throw new Exception("fail!");
>     }
>     finally {
>       long end = 0;
>       long time = end - start;
>     }
>   }
> }
> new Test().run();
> {code}
> I would expect to see the following output:
> {code}
> java.lang.Exception: fail!
>       at Test.run(ConsoleScript1:5)
>       at Test$run.call(Unknown Source)
>       at ConsoleScript1.run(ConsoleScript1:13)
> {code}
> However, instead, I see:
> {code}
> groovy.lang.MissingPropertyException: No such property: time for class: Test
>       at Test.run(ConsoleScript1:9)
>       at Test$run.call(Unknown Source)
>       at ConsoleScript1.run(ConsoleScript1:13)
> {code}
> If I change the script to the following:
> {code}
> class Test {
>   void run() {
>     long start = 0;
>     try {
>       throw new Exception("fail!");
>     }
>     finally {
>       def end = 0;
>       long time = end - start;
>     }
>   }
> }
> new Test().run();
> {code}
> I get the expected output. Seems like a bug.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to