How does one handle a java method which returns a non-public sub-type via reflection?
Jochen Theodorou
blackdrag at gmx.org
Mon Jan 15 14:42:52 UTC 2018
Am 12.01.2018 um 22:49 schrieb Michał Zegan:
> well you rather know what getChildren returns, so you know what the
> returned object is, like generally.
but as soon as the method you want to call is not on the statically
declared type, nor within a set of known statically types you are having
a problem. There is no good way (good in terms of usability and
performance) to get an arbitrary valid method object without static
information. You are always forced to traverse the hierarchy to find the
most accessible type. You will have to check access... and then of
course there the two bad scenarios where invocation and search are not
the same class or actual caller and caller are not equal. Which leads to
a lengthy search using reflection to find a method, transfer it to a
method handle and then let the invoker do the actual call.
bye Jochen
More information about the jigsaw-dev
mailing list