BCEL

BCEL

Documentation

Download

Get Involved

FAQ

Q: Is the BCEL thread-safe?
A: BCEL was (deliberately) not designed for thread safety. See "Concurrent Programming in Java", by Doug Lea, for an excellent reference on how to build thread-safe wrappers.

Q: Can I use BCEL in a commercial product?
A: Yes, this is covered by the LGPL, if you add a note about the original author and where to find the sources, i.e., this URL.

Q: (Typically for users of SUN's XSLTC) I'm getting

    de.fub.bytecode.generic.ClassGenException: Branch target offset too large for short
    
when compiling large files.
A: The answer lies in internal limitations of the JVM, branch instruction like goto can not address offsets larger than a short integer, i.e. offsets >= 32767.
The solution is to split the branch into in intermediate hops, which the XSLTC obviously doesn't take care off. Blame SUN ;-) (In fact you could replace gotos with the goto_w instruction, but this would help in the other cases).

Q: Can I create or modify classes dynmically with BCEL?
A: Since 4.4.0 BCEL contains useful classes in the de.fub.bytecode.util package, namely ClassLoader and JavaWrapper. Take a look at the ProxyCreator example.



Copyright © 1999-2001, Apache Software Foundation