groovy-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Paul King (JIRA)" <j...@apache.org>
Subject [jira] [Closed] (GROOVY-7248) MissingPropertyException: No such property in finally block
Date Sat, 18 Mar 2017 09:57:42 GMT

     [ https://issues.apache.org/jira/browse/GROOVY-7248?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Paul King closed GROOVY-7248.
-----------------------------

> 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
>            Assignee: John Wagenleitner
>             Fix For: 2.4.10
>
>         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)

Mime
View raw message