jOOQ / jOOR

jOOR - Fluent Reflection in Java jOOR is a very simple fluent API that gives access to your Java Class structures in a more intuitive way. The JDK's reflection APIs are hard and verbose to use. Other languages have much simpler constructs to access type meta information at runtime. Let us make Java reflection better.
http://www.jooq.org/products
Apache License 2.0
2.81k stars 375 forks source link

Consider method handles #3

Open lukaseder opened 11 years ago

lukaseder commented 11 years ago

See also: https://code.google.com/p/joor/issues/detail?id=19

iirekm commented 9 years ago

There are problems with this approach:

MethodHandles may also provide automatic resolution of 'similar' methods, but it works only for methods which are visible from current code. If someone wants to call visible 'similar' methods in everyday programming then should rather consider dynamic languages like Groovy (they can use invokedynamic and MethodHandles).

lukaseder commented 9 years ago

won't work in Java 6 (there are still projects that have to support it) and Android (I guess that current joor should work there without problems)

We can catch NoSuchMethodError or NoClassDefFoundError in a static initialiser and see whether this feature is accessible or not. If it isn't, there's still the possibility to implement stuff with pre-Java-7 API.

MethodHandles also have a quite big lookup cost, so no real gain

Probably true

If someone wants to call visible 'similar' methods in everyday programming then should rather consider dynamic languages like Groovy

That's correct. The use-cases of jOOR are limited. We designed it mostely for integration testing. Certainly, actual method handle support is low-prio. I'll fix tags accordingly.