You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Given the discussions on #3496 (and corresponding PR #3494) as well as the new @BindParam I think the reflective bean converter needs some cleanup and possibly should be available as public API.
Some issues:
It is bizarre how it does not implement BeanConverter which makes looking for it tricky.
Strangely it gets created on every request as a fallback. Maybe escape analysis is working and it is fine performance wise but it makes me wonder if it is threadsafe when I see that.
Ideally it uses MethodHandles instead of the older reflection API.
The last point is important in a modular world. There are two choices in allow reflective access if your application is modular. You either
open everything up (as in put open module declaration or package)
or you pass a MethodHandles.Lookup to the library (jooby) doing the reflection.
Thus we should allow one want to do something like (the following may not be correct but roughly):
Joobyapp = ...;
varlookup = MethodHandles.lookup(); // the consumer of jooby calls thisapp.converter(newReflectiveBeanConverter(lookup)); // or however we replace the default one.
On a separate note Handlebars.java should do something similar for version 5. In fact you could do
varlookup = MethodHandles.lookup(); // the consumer of jooby calls thisapp.registerLookup(lookup); // register lookup to be used by jooby modules.// jooby handlebars module then does varlookupapp.getLookup();
Handlebarshandlebars = newHandlebars(lookup); // or whatever is analogous
I can try to take a stab at a PR if you like. A bonus to using MethodHandles is that they are supposedly can be faster than regular reflection.
The text was updated successfully, but these errors were encountered:
Given the discussions on #3496 (and corresponding PR #3494) as well as the new
@BindParam
I think the reflective bean converter needs some cleanup and possibly should be available as public API.Some issues:
BeanConverter
which makes looking for it tricky.The last point is important in a modular world. There are two choices in allow reflective access if your application is modular. You either
open
everything up (as in putopen
module declaration or package)MethodHandles.Lookup
to the library (jooby) doing the reflection.Thus we should allow one want to do something like (the following may not be correct but roughly):
On a separate note Handlebars.java should do something similar for version 5. In fact you could do
I can try to take a stab at a PR if you like. A bonus to using MethodHandles is that they are supposedly can be faster than regular reflection.
The text was updated successfully, but these errors were encountered: