Kava - A Reflective Java Based on Bytecode Rewriting
Current implementations of reflective Java typically either require access to source code, or require a modified Java platform. This makes them unsuitable for applying reflection to Commercial-off-the-Shelf (COTS) systems. The high level nature of Java bytecode makes on-the-fly rewritings of class files feasible and this has been exploited by a number of authors. However, in practice working at bytecode level is error prone and leads to fragile code. We propose using metaobject protocols in order to specify behavioural changes and use standard bytecode rewritings to implement the changes. We have developed a reflective Java called Kava that provides behavioural runtime reflection through the use of bytecode rewriting of Java classes. In this paper we discuss the binary rewriting approach, provide an overview of the Kava system and provide an example of an application of Kava.
KeywordsSource Code Java Class Method Invocation Java Implementation Code Instruction
Unable to display preview. Download preview PDF.
- 1.Massimo Ancona, Walter Cazzola, and Eduardo B. Fernandez. Reflective Authorization Systems: Possibilities, Benefits and Drawbacks. In Jan Vitek and Christian Jensen, editors, Secure Internet Programming: Security Issues for Mobile and Distributed Objects, Lecture Notes in Computer Science 1603, pages 35–51. Springer-Verlag, July 1999.Google Scholar
- 3.Ole Agesen, Stephen N. Freund and John C. Mitchell. Adding Type Parameterization. In Proceedings of OOPSLA’97. Atlanta, Georgia. 1997.Google Scholar
- 4.Shigeru Chiba. Load-time Structural Reflection in Java. In Proceedings of ECOOP’2000. June 2000.Google Scholar
- 5.Geoff A. Cohen and Jeff Chase. Automatic Program Transformation with JOIE. In Proceedings of USENIX Annual Technical Symposium. 1998.Google Scholar
- 6.Grzegorz Czaijkowski and Thorsten von Eicken. JRes: A Resource Accounting Interface for Java. In Proceedings of OOPSLA’98. 1998.Google Scholar
- 7.Michael Gölm. Design and Implementation of a Meta Architecture for Java. Master’s thesis, University of Erlangen-Nurnberg, Germany, January 1997.Google Scholar
- 8.Joao Guimarães. Reflection for Statically Typed Languages. In Proceedings of ECOOP’98. July 1998.Google Scholar
- 9.IBM. Bean Extender Documentation, version 2.0. 1997.Google Scholar
- 10.Ralph Keller and Urs Holzle. Binary Component Adaptation. In Proceedings of ECOOP’98. July 1998.Google Scholar
- 11.Ruiz-Garcia Marc-Olivier Killijian, Jean-Charles Fabre and Shigeru Chiba. A Metaobject Protocol for Fault-Tolerant CORBA Applications. In Proceedings of the 17th Symposium on Reliable Distributed Systems (SRDS’98), pages 127–134, 1998.Google Scholar
- 12.Gregor Kickzales, Jim des Rivières, and Daniel G. Bobrow. The Art of the Metaobject Protocol. MIT Press, Cambridge, Massachusetts, 1991.Google Scholar
- 13.Sheng Liang and Gilad Bracha. Dynamic Class Loading in the Java™ Virtual Machine. In Proceedings of OOPSLA’98, Vancouver, Canada, October 1998.Google Scholar
- 14.Satoshi Matsuoka, Hirotaka Ogawa, Kouya Shimura, Yasunori Kimura, Koichiro Hotta, and Hiromitsu Takagi. OpenJIT A Reflective Java JIT Compiler. In Proceedings of OOPSLA’98 Workshop on Reflective Programming in C++ and Java, November 1998.Google Scholar
- 15.Alexandre Olivia, Luis Eduardo Buzato, and Calciolari Islene. The Reflective Architecture of Guaraná. http://www.dcc.unicamp.br/oliva.
- 16.Insik Shin and John C. Mitchell. Java Bytecode Modification and Applet Security. Stanford CS Tech Report. 1998.Google Scholar
- 17.Robert J. Stroud. Transparency and Reflection in Distributed Systems. ACM Operating System Review, 22:99–103, April 1992.Google Scholar
- 18.Robert J. Stroud and Zhixue Wu. Using Metaobject Protocols to Satisfy Non-Functional Requirements. In Chris Zimmerman, editor, Advances in Object-Oriented Metalevel Architectures and Reflection, chapter 3, pages 31–52. CRC Press, Inc., 2000 Corporate Blvd., N.W., Boca Raton, Florida 33431, 1996.Google Scholar
- 19.Robert J. Stroud and Zhixue Wu. Using Meta-Object Protocol to Implement Atomic Data Types. In Walter Olthoff, editor, Proceedings of the 9th Conference on Object-Oriented Programming (ECOOP’95), LNCS 952, pages 168–189, Aarhus, Denmark, August 1995. Springer-Verlag.Google Scholar
- 20.Sun Microsystems, Inc. Java Development Kit version 1.3.0 Documentation. 2000.Google Scholar
- 21.Michiaki Tatsubori and Shigeru Chiba. Support of Design Patterns with Compile-time Reflection. In Shigeru Chiba and Jean-Charles Fabre, editors, Proceedings of OOPSLA Workshop on Reflective Programming in C++ and Java, Vancouver, Canada, November 1998.Google Scholar
- 22.Ian Welch and Robert J. Stroud. Dalang-A Reflective Extension for Java. Computing Science Technical Report CS-TR-672, University of Newcastle upon Tyne. 1999.Google Scholar
- 23.Ian Welch and Robert J. Stroud. From Dalang to Kava-The Evolution of a Reflective Java Extension. In Proceedings of Meta-Level Architectures and Reflection, Second International Conference, Reflection 1999, page 19–21. Saint-Malo, France. LNCS 1616, Springer. July 1999.Google Scholar
- 24.Ian Welch and Robert J. Stroud. Supporting Real World Security Models in Java. In Proceedings of 7th IEEE International Workshop on Future Treads of Distributed Computing Systems, pages 20–22. Cape Town, South Africa. TIEEE Computer Society. December 1999.Google Scholar
- 25.Zhixue Wu and Scarlet Schwiderski. Reflective Java-Making Java Even More Flexible. FTP: Architecture Projects Management Limited (http://firstname.lastname@example.org), Cambridge, UK. 1997.
- 26.Chris Zimmerman. Metalevels, MOPs and What all the Fuzz is All about. In Chris Zimmerman, editor, Advances in Object-Oriented Metalevel Architectures and Reflection, chapter 1, pages 3–24. CRC Press, Inc., 2000 Corporate Blvd., N.W., Boca Raton, Florida 33431, 1996.Google Scholar