Skip navigation links

Package serp.bytecode

Bytecode Manipuation

See: Description

Package serp.bytecode Description

Bytecode Manipuation

This package contains a framework for Java bytecode manipulation.

Bytecode manipulation is a powerful tool in the arsenal of the Java developer. It can be used for tasks from compiling alternative programming languages to run in a JVM, to creating new classes on the fly at runtime, to instrumenting classes for performance analysis, to debugging, to altering or enhancing the capabilities of existing compiled classes. Traditionally, however, this power has come at a price: modifying bytecode has required an in-depth knowledge of the class file structure and has necessitated very low-level programming techniques. These costs have proven too much for most developers, and bytecode manipulation has been largely ignored by the mainstream.

The goal of the serp bytecode framework is to tap the full power of bytecode modification while lowering its associated costs. The framework provides a set of high-level APIs for manipulating all aspects of bytecode, from large-scale structures like class member fields to the individual instructions that comprise the code of methods. While in order to perform any advanced manipulation, some understanding of the class file format and especially of the JVM instruction set is necessary, the framework makes it as easy as possible to enter the world of bytecode development.

There are several other excellent bytecode frameworks available. Serp excels, however, in the following areas:

Serp is not ideally suited to all applications. Here are a few disadvantages of serp:

The first class that you should study in this package is the Project type. From there, move onto the BCClass, and trace its APIs into BCFields, BCMethods, and finally into actual Code.

Skip navigation links

Copyright © 2002–2019. All rights reserved.