3. What is Reflection?
Reflection is the ability of a program to examine itself, modify its structure,
modify state using the structural information and generate new state and
structure.
4. How is reflection possible?
Representation of the source (metadata) should be available at runtime (The
compiler should bake the required meta information).
Runtime should provide APIs to reflect.
5. How does javac & jvm makes Reflection
possible?
Class file format
Class(.class) & the Class loader
11. Limitations of Java Reflection
Cannot manipulate & generate code
Deep introspection on code is not possible
Solution : Need bytecode manipulation support.
Third party options : ASM, Javassist, BCEL, CGLIB
12. What is not covered
MethodHandles
Java 9 Changes
13. Few Articles
SimplifyJSPServlet - A web framework on top of Servlet, this makes use of
reflection
https://sarathsoman.wordpress.com/2014/05/29/making-simplifyjspservlet-thr
ead-safe/
PVSContainer - A dependency injection container, uses ASM to get class meta
data and reflection for dependency injection
https://sarathsoman.wordpress.com/category/java/pvscontainer/
Reflections in Golang -
https://sarathsoman.wordpress.com/2016/12/27/reflections-in-golang-example
14. Few Articles
The Class & The ClassLoader -
https://sarathsoman.wordpress.com/2014/01/15/the-class-the-classloader/
Java Reflection Example -
https://sarathsoman.wordpress.com/2014/01/12/invoking-methods-annotated-
with-the-time-for-invokation-using-java-reflection
Java Proxy -
https://sarathsoman.wordpress.com/2014/01/10/decoupling-cross-cutting-con
cerns-using-java-proxy-an-example