Kava - Using Byte code Rewriting to add Behavioural Reflection to Java

Many authors have proposed using byte code rewriting as a way of adapting or extending the behaviour of Java classes. There are toolkits available that simplify this process and raise the level of abstraction above byte code. However, to the best of our knowledge, none of these toolkits provide a complete model of behavioural reflection for Java. In this paper, we describe how we have used load-time byte code rewriting techniques to construct a run-time metaobject protocol for Java that can be used to adapt and customise the behaviour of Java classes in a more flexible and abstract way. Apart from providing a better semantic basis for byte code rewriting techniques, our approach also has the advantage over other reflective Java implementations that it doesn't require a modified compiler or JVM, can operate on byte code rather than source code and cannot be bypassed. In this paper we describe the implementation of Kava, our reflective implementation of Java, and discuss some of the linguistic issues and technical challenges involved in implementing such a tool on top of a standard JVM. Kava is available from http://www.cs.ncl.ac.uk/research/dependability/reflection.

[1]  Satoshi Matsuoka,et al.  OpenJIT: An Open-Ended, Reflective JIT Compiler Framework for Java , 2000, ECOOP.

[2]  Jean-Charles Fabre,et al.  Implementing fault tolerant applications using reflective object-oriented programming , 1995 .

[3]  Michiaki Tatsubori,et al.  Programming Support of Design Patterns with Compile-time Reflection , 2000 .

[4]  Urs Hölzle,et al.  Integrating Independently-Developed Components in Object-Oriented Languages , 1993, ECOOP.

[5]  Urs Hölzle,et al.  Binary Component Adaptation , 1997, ECOOP.

[6]  Robert J. Stroud,et al.  Using Metaobject Protocols to Implement Atomic Data Types , 1995, ECOOP.

[7]  Ian Welch,et al.  From Dalang to Kava - The Evolution of a Reflective Java Extension , 1999, Reflection.

[8]  Akinori Yonezawa,et al.  Hybrid Group Reflective Architecture for Object-Oriented Concurrent Reflective Programming , 1991, ECOOP.

[9]  Ian Welch,et al.  Kava - A Reflective Java Based on Bytecode Rewriting , 1999, Reflection and Software Engineering.

[10]  Luiz Eduardo Buzato,et al.  The Design and Implementation of Guaraná , 1999, COOTS.

[11]  Geoff A. Cohen,et al.  Automatic Program Transformation with JOIE , 1998, USENIX Annual Technical Conference.

[12]  Shigeru Chiba,et al.  Load-Time Structural Reflection in Java , 2000, ECOOP.

[13]  Daniel G. Bobrow,et al.  Book review: The Art of the MetaObject Protocol By Gregor Kiczales, Jim des Rivieres, Daniel G. and Bobrow(MIT Press, 1991) , 1991, SGAR.

[14]  José de Oliveira Guimarães,et al.  Reflection for Statically Typed Languages , 1998, ECOOP.

[15]  Robert J. Stroud,et al.  Implementing fault tolerant applications using reflective object-oriented programming , 1995, Twenty-Fifth International Symposium on Fault-Tolerant Computing. Digest of Papers.

[16]  Raju Pandey,et al.  Providing Fine-grained Access Control for Java Programs , 1999, ECOOP.

[17]  Thorsten von Eicken,et al.  JRes: a resource accounting interface for Java , 1998, OOPSLA '98.

[18]  Pattie Maes Concepts and experiments in computational reflection , 1987, OOPSLA 1987.

[19]  Bob Blakley,et al.  Approach to Object Security in Distributed SOM , 1996, IBM Syst. J..