groovy-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Maik Igloffstein (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (GROOVY-8147) Dynamic non existing property access with different MissingPropertyException
Date Fri, 07 Apr 2017 06:45:42 GMT

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

Maik Igloffstein updated GROOVY-8147:
-------------------------------------
    Affects Version/s: 2.5.0-alpha-1

> Dynamic non existing property access with different MissingPropertyException
> ----------------------------------------------------------------------------
>
>                 Key: GROOVY-8147
>                 URL: https://issues.apache.org/jira/browse/GROOVY-8147
>             Project: Groovy
>          Issue Type: Bug
>          Components: groovy-runtime
>    Affects Versions: 2.4.7, 2.5.0-alpha-1
>            Reporter: Maik Igloffstein
>            Priority: Minor
>
> {code}new Propy()."$foo"{code}
> Throws a {{org.codehaus.groovy.runtime.metaclass.MissingPropertyExceptionNoStack}}.
> {code}new Propy()[foo]{code}
> Throws a {{groovy.lang.MissingPropertyException}}.
> Why? How to force throwing a MissingPropertyException instead of MissingPropertyExceptionNoStack?
> h3. Example code
> {code}
> class Propy {
> }
> def foo = 'bar'
> def e1,e2
> try {
>     new Propy()."$foo"
> } catch (e) {
>     e1 = e
> }
> try {
>     new Propy()[foo]
> } catch (e) {
>     e2 = e
> }
> println "${e1.'class'.name} != ${e2.'class'.name}"
> assert e1.'class'.name != e2.'class'.name // but why?!
> {code}



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

Mime
View raw message