On Sun, 10 Jan 2021 23:30:58 GMT, Peter Levart <plev...@openjdk.org> wrote:
>>> How frequent are situations where the two classloaders are unrelated? >> >> I think they'd be extremely unlikely. The only user of these right now is >> Dynalink's type converter factory. I _can imagine_ a situation where there's >> a conversion from a dynamic language runtime's internal "object" type to an >> application-specific Java interface, or from its internal "function object" >> type to an app-specific Java SAM type, and for some reason the app-specific >> types aren't in the same or descendant class loader of the language >> runtime's loader. >> Frankly, I'd expect 99.99% of the time, app classes would be in the >> same-or-descendant class loader relative to the dynamic language runtime >> types. It'd have to be a really exotic setup for this not to be the case, >> but I'd rather not second guess the users and provide a reasonable >> functionality even in this case. >> If you're thinking of rather throwing an exception when they're unrelated… >> well, we could certainly do that but I give it a mean time of six months >> before somebody runs into it and asks about it on Stack Overflow. > > Well, I was just thinking if it might be more frequent and would benefit from > caching the result too. But if it is not, then what you have now is OK. @plevart would you be then be okay with approving this PR? Also, @hns or @sundararajana can I maybe get a review from either of you? ------------- PR: https://git.openjdk.java.net/jdk/pull/1918