[
https://issues.apache.org/jira/browse/GROOVY-8147?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17146831#comment-17146831
]
Andres Almiray commented on GROOVY-8147:
----------------------------------------
Property access occurs using 2 different methods (`getProperty` vs. `getAt`)
> 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, 3.0.4
> 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
(v8.3.4#803005)