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/03/09 13:20:38 UTC

[jira] [Commented] (GROOVY-7248) MissingPropertyException: No such property in finally block

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

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

Github user asfgit closed the pull request at:

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


> 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)