Toggle Main Menu Toggle Search

Open Access padlockePrints

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

Lookup NU author(s): Ian Welch, Dr Robert Stroud



Many authors have proposed using byte code rewriting as a way of adapting or exending the behaviour of Java classes. There are toolkits available that simplify this process and raise the level of abstration 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 techinques to construct a runtime 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 bute code rewriting techniques, our approach also has the advantage over other reflective Java implementations in 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

Publication metadata

Author(s): Welch I, Stroud RJ

Publication type: Report

Publication status: Published

Series Title: Department of Computing Science Technical Report Series

Year: 2000

Pages: 4

Print publication date: 01/01/2000

Source Publication Date: 2000

Report Number: 704

Institution: Department of Computing Science, University of Newcastle upon Tyne

Place Published: Newcastle upon Tyne