Load-Time Structural Reflection in Java

  • Shigeru Chiba
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 1850)


The standard reflection API of Java provides the ability to introspect a program but not to alter program behavior. This paper presents an extension to the reflection API for addressing this limitation. Unlike other extensions enabling behavioral reflection, our extension called Javassist enables structural reflection in Java. For using a standard Java virtual machine (JVM) and avoiding a performance problem, Javassist allows structural reflection only before a class is loaded into the JVM. However, Javassist still covers various applications including a language extension emulating behavioral reflection. This paper also presents the design principles of Javassist, which distinguish Javassist from related work.


Runtime System Load Time Java Virtual Machine Class Library Language Extension 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Brant, J., B. Foote, R. E. Johnson, and D. Roberts, “Wrappers to the Rescure,” in ECOOP’98-Object Oriented Programming, LNCS 1445, pp. 396–417, Springer, 1998.Google Scholar
  2. 2.
    Braux, M. and J. Noyé, “Towards Partially Evaluating Reflection in Java,” in Proc. of Symposium on Partial Evaluation and Semantics-Based Program Manipulation (PEPM’00), SIGPLAN Notices vol. 34, no. 11, pp. 2–11, ACM, 1999.CrossRefGoogle Scholar
  3. 3.
    Chiba, S., “A Metaobject Protocol for C++,” in Proc. of ACM Conf. on Object-Oriented Programming Systems, Languages, and Applications, SIGPLAN Notices vol. 30, no. 10, pp. 285–299, ACM, 1995.CrossRefGoogle Scholar
  4. 4.
    Chiba, S. and T. Masuda, “Designing an Extensible Distributed Language with a Meta-Level Architecture,” in Proc. of the 7th European Conference on Object-Oriented Programming, LNCS 707, pp. 482–501, Springer-Verlag, 1993.Google Scholar
  5. 5.
    Cohen, G. A., J. S. Chase, and D. L. Kaminsky, “Automatic Program Transformation with JOIE,” in USENIX Annual Technical Conference’ 98, 1998.Google Scholar
  6. 6.
    Cointe, P., “Metaclasses are first class: The ObjVlisp model,” in Proc. of ACM Conf. on Object-Oriented Programming Systems, Languages, and Applications, pp. 156–167, 1987.Google Scholar
  7. 7.
    Dahm, M., “Byte Code Engineering with the JavaClass API,” Techincal Report B-17-98, Institut für Informatik, Freie Universität Berlin, January 1999.Google Scholar
  8. 8.
    Ellis, M. and B. Stroustrup, eds., The Annotated C++ Reference Manual. Addison-Wesley, 1990.Google Scholar
  9. 9.
    Fabre, J. C. and T. Pérennou, “A Metaobject Architecture for Fault Tolerant Distributed Systems: The FRIENDS Approach,” IEEE Transactions on Computers, vol. 47, no. 1, pp. 78–95, 1998.CrossRefGoogle Scholar
  10. 10.
    Goldberg, A. and D. Robson, Smalltalk-80: The Language and Its Implementation. Addison-Wesley, 1983.Google Scholar
  11. 11.
    Golm, M. and J. Kleinöder, “Jumping to the Meta Level, Behavioral Reflection Can Be Fast and Flexible,” in Proc. of Reflection’ 99, LNCS 1616, pp. 22–39, Springer, 1999.Google Scholar
  12. 12.
    Hölzle, U. and D. Ungar, “A Third Generation Self Implementation: Reconciling Responsiveness with Performance,” in Proc. of ACM Conf. on Object-Oriented Programming Systems, Languages, and Applications, SIGPLAN Notices vol. 29, no. 10, pp. 229–243, 1994.CrossRefGoogle Scholar
  13. 13.
    Keller, R. and U. Hölzle, “Binary Component Adaptation,” in ECOOP’98-Object Oriented Programming, LNCS 1445, pp. 307–329, Springer, 1998.CrossRefGoogle Scholar
  14. 14.
    Kiczales, G., J. des Riviéres, and D. G. Bobrow, The Art of the Metaobject Protocol. The MIT Press, 1991.Google Scholar
  15. 15.
    Kirby, G., R. Morrison, and D. Stemple, “Linguistic Reflection in Java,” Software-Practice and Experience, vol. 28, no. 10, pp. 1045–1077, 1998.CrossRefGoogle Scholar
  16. 16.
    Kleinöder, J. and M. Golm, “MetaJava: An Efficient Run-Time Meta Architecture for Java,” in Proc. of the International Workshop on Object Orientation in Operating Systems (IWOOS’96), IEEE, 1996.Google Scholar
  17. 17.
    Masuhara, H. and A. Yonezawa, “Design and Partial Evaluation of Meta-objects for a Concurrent Reflective Languages,” in ECOOP’98-Object Oriented Programming, LNCS 1445, pp. 418–439, Springer, 1998.CrossRefGoogle Scholar
  18. 18.
    Ogawa, H., K. Shimura, S. Matsuoka, F. Maruyama, Y. Sohda, and F. Kimura, “OpenJIT: An Open-Ended, Reflective JIT Compiler Framework for Java,” in Proc. of ECOOP’2000, Springer Verlag, 2000. To appear.Google Scholar
  19. 19.
    Sun Microsystems, “Java™ 2 SDK Documentation.” version 1.3 (beta release), 1999.Google Scholar
  20. 20.
    Tatsubori, M., S. Chiba, M.-O. Killijian, and K. Itano, “OpenJava: A Class-based Macro System for Java,” in Reflection and Software Engineering (W. Cazzola, R. J. Stroud, and F. Tisato, eds)., LNCS 1826, Springer Verlag, 2000.CrossRefGoogle Scholar
  21. 21.
    Welch, I. and R. Stroud, “From Dalang to Kava-The Evolution of a Reflective Java Extension,” in Proc. of Reflection’ 99, LNCS 1616, pp. 2–21, Springer, 1999.Google Scholar
  22. 22.
    Wu, Z., “Reflective Java and A Reflective-Component-Based Transaction Architecture,” in Proc. of OOPSLA’98 Workshop on Reflective Programming in C++ and Java (J.-C. Fabre and S. Chiba, eds)., 1998.Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2000

Authors and Affiliations

  • Shigeru Chiba
    • 1
  1. 1.Institute of Information Science and ElectronicsUniversity of Tsukuba and Japan Science and Technology CorpJapan

Personalised recommendations