You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@groovy.apache.org by "ocs@ocs" <oc...@ocs.cz> on 2018/08/18 14:23:54 UTC
static block called too late for installing a propertyMissing (sans
indy only)
Ladies and gentlemen,
I have bumped into another suspicious behaviour: is this all right? Happens both with 2.4 and 3.0 same way.
Thanks and all the best,
OC
===
717 /tmp> <q.groovy
class zz {
static {
println "propertyMissing installed to $this"
zz.metaClass.static.propertyMissing={ println "prop $it OK" }
}
}
zz.bar // sans indy, crashes before static called and propertyMissing installed
718 /tmp> /usr/local/groovy-3.0.0-alpha-3/bin/groovy q
WARNING: Using incubator modules: jdk.incubator.httpclient
Caught: groovy.lang.MissingPropertyException: No such property: bar for class: zz
groovy.lang.MissingPropertyException: No such property: bar for class: zz
at q.run(q.groovy:7)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
719 /tmp> /usr/local/groovy-3.0.0-alpha-3/bin/groovy --indy q
WARNING: Using incubator modules: jdk.incubator.httpclient
propertyMissing installed to class zz
prop bar OK
720 /tmp>
===