Point in Lifecycle |
Reflective Java |
Description |
Capabilities |
Restrictions |
Source Code |
Reflective Java [17] |
Preprocessor. |
Dynamic switching of metaobjects. Intercept method invocations. |
Can’t make a compiled class reflective, requires access to source code. |
Compile Time |
OpenJava [18] |
Compile-time metaobject protocol. |
Can intercept wide range of operations, and extends language syntax. |
Requires access to source code. |
Byte Code |
Bean Extender [19], Dalang [20], JavaAssist [7] |
Byte code preprocessor (Bean Extender), byte code rewriting as late as load time (Dalang, JavaAssist). |
No need to have access to source code. |
Bean Extender – restricted to Java Beans. Dalang, and Javassist – limited capabilities. requires offline preprocessing. |
Runtime |
MetaXa [21], Rjava [22], Guarana [23] |
Reflective JVMs. |
Can intercept wide range of operations. Can be dynamically applied. |
Custom JVM. |
java.lang. |
Reflective capabilities part of the standard Java development kit. |
Runtime introspection, dynamic dispatch and on-the-fly generation of proxies. |
Overall introspection rather than behavioural or structural reflection. |
|
Just-in-time Compilation |
OpenJIT [24] |
Compile-time metaobject protocol for compilation to machine language. |
Can take advantage of facilities present in the native platform. No need for access to source code. Dynamic adaptation. |
Custom Just-in-time compiler. |