Java Bytecode Verification with OCL Why, How and Whenc

By: Christoph Bockisch, Gabriele Taentzer, Nebras Nassar, Lukas Wydra


Program transformations are frequently developed, e.g., to realize programming language extensions or dynamic program analyses such as profiling. They are typically implemented by manipulating bytecode as the availability of source code is not guaranteed. There are standard libraries such as ASM that are typically used for implementing Java bytecode manipulations. To check their correctness, they are usually tested by applying them to different programs, running the manipulated programs and observing their behaviors. As part of the second step, the Java virtual machine verifies the bytecode, which can uncover errors in the bytecode introduced by the manipulation. That approach uses different technologies that are not well linked making the process of developing and testing bytecode manipulations difficult. In this paper, we intend to perform bytecode manipulation by using concepts and techniques of model-driven engineering. We are convinced that the declarative nature of model transformation rules allows the debugging and analyzing of bytecode manipulations in more details than classically done. Following this path, a meta-model for bytecode is needed including OCL constraints for bytecode verification. We analyze the semantic rules of the bytecode verifier according to their complexity factor, present a meta-model for Java bytecode, show how the semantic rules can be expressed as OCL constraints on top of this meta-model, and show that basing bytecode manipulation on model transformation can provide more immediate guidance and feedback to the developer.


Program transformation, Java bytecode, meta-model, OCL, bytecode verification.

Cite as:

Christoph Bockisch, Gabriele Taentzer, Nebras Nassar, Lukas Wydra, “Java Bytecode Verification with OCL Why, How and Whenc”, Journal of Object Technology, Volume 19, no. 3 (October 2020), pp. 3:1-16, doi:10.5381/jot.2020.19.3.a13.

PDF | DOI | BiBTeX | Tweet this | Post to CiteULike | Share on LinkedIn

This article is accompanied by a video realized by the author(s).

The JOT Journal   |   ISSN 1660-1769   |   DOI 10.5381/jot   |   AITO   |   Open Access   |    Contact