You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Maik Igloffstein (JIRA)" <ji...@apache.org> on 2017/04/07 06:40:41 UTC
[jira] [Created] (GROOVY-8147) Dynamic non existing property access
with different MissingPropertyException
Maik Igloffstein created GROOVY-8147:
----------------------------------------
Summary: 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
Reporter: Maik Igloffstein
Priority: Minor
h3. Explaination
{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)