groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeremy Heiner <jere...@imagemattersllc.com>
Subject Re: help understanding methodMissing on non-Groovy classes
Date Thu, 09 Nov 2017 20:56:45 GMT
Addendum... oops, looks like I forgot to include the output! Here it
is (after Emacs has aligned the org-mode tables - best viewed in
monospace font):

=============================================================================
make clean run
rm *.class
kotlinc -cp /usr/share/groovy/embeddable/groovy-all.jar  Kt.kt
groovy -cp .:/usr/share/kotlin/lib/kotlin-runtime.jar     run.groovy
Gr.callWith( 3, Gr@4802796d, 692331943 )
|----------------------+-----------+----------------|
|                      | this      | run@206a70ef   |
|                      | delegate  | Gr@4802796d    |
|                      | it        | Gr@4802796d    |
| Gr@4802796d.pM(prop) | it.prop   | Gr.pM:prop     |
| Gr@4802796d.mM(mth)  | it.mth(1) | Gr.mM:mth([1]) |
| Gr@4802796d.pM(prop) | prop      | Gr.pM:prop     |
| Gr@4802796d.mM(mth)  | mth(2)    | Gr.mM:mth([2]) |
|----------------------+-----------+----------------|
Kt.callWith( 3, Gr@4802796d, 692331943 )
|----------------------+-----------+----------------|
|                      | this      | run@206a70ef   |
|                      | delegate  | Gr@4802796d    |
|                      | it        | Gr@4802796d    |
| Gr@4802796d.pM(prop) | it.prop   | Gr.pM:prop     |
| Gr@4802796d.mM(mth)  | it.mth(1) | Gr.mM:mth([1]) |
| Gr@4802796d.pM(prop) | prop      | Gr.pM:prop     |
| Gr@4802796d.mM(mth)  | mth(2)    | Gr.mM:mth([2]) |
|----------------------+-----------+----------------|
Gr.callWith( 3, Kt@1573f9fc, 692331943 )
|----------------------+-----------+-------------------------------------------------------------------------------------------------------------------|
|                      | this      | run@206a70ef

         |
|                      | delegate  | Kt@1573f9fc

         |
|                      | it        | Kt@1573f9fc

         |
| Kt@1573f9fc.pM(prop) | it.prop   | Kt.pM:prop

         |
| Kt@1573f9fc.mM(mth ) | it.mth(1) |
Kt.mM:mth([Ljava.lang.Object;@1f2586d6)
                                           |
| Kt@1573f9fc.pM(prop) | prop      | Kt.pM:prop

         |
|                      | mth(2)    | No signature of method:
run$_run_closure1.mth() is applicable for argument types:
(java.lang.Integer) values: [2] |
|----------------------+-----------+-------------------------------------------------------------------------------------------------------------------|
Kt.callWith( 3, Kt@1573f9fc, 692331943 )
|----------------------+-----------+-------------------------------------------------------------------------------------------------------------------|
|                      | this      | run@206a70ef

         |
|                      | delegate  | Kt@1573f9fc

         |
|                      | it        | Kt@1573f9fc

         |
| Kt@1573f9fc.pM(prop) | it.prop   | Kt.pM:prop

         |
| Kt@1573f9fc.mM(mth ) | it.mth(1) |
Kt.mM:mth([Ljava.lang.Object;@4116aac9)
                                           |
| Kt@1573f9fc.pM(prop) | prop      | Kt.pM:prop

         |
|                      | mth(2)    | No signature of method:
run$_run_closure1.mth() is applicable for argument types:
(java.lang.Integer) values: [2] |
|----------------------+-----------+-------------------------------------------------------------------------------------------------------------------|

So, to repeat, the mystery is why the closure is searched for the
missing method call instead of the delegate.

Mime
View raw message