Hervian / lambda-factory

A fast alternative to Java Reflection API's method invocation
Apache License 2.0
119 stars 33 forks source link

Add documentation how it works #6

Closed raderio closed 7 years ago

raderio commented 7 years ago

Please add documentation how it works. Is it generate the code?

Hervian commented 7 years ago

Hi raderio. Sorry for the late reply.

As written in the Projects documentation the code Works as follows:

  1. The magic behind the scenes is based on Java 8's LambdaMetaFactory. As such you should see https://docs.oracle.com/javase/8/docs/api/java/lang/invoke/LambdaMetafactory.html.

  2. Yes, the project's compilation generates code, namely the class Lambda. As I recall LambdaMetaFactory also generates code, namely a "Lambda" which is a class that implements the defined method. But Again, this is something which is already documented by the javadoc of LambdaMetaFactory. See also this SO answer: http://stackoverflow.com/a/23991339/6095334. In general: All of Holger's answers are wellwritten and very enlightning (http://stackoverflow.com/users/2711488/holger).