BCEL User FAQ
This FAQ is the result of some problems/struggles I had using BCEL. Since I conquered that step, I am passing knowledge to you.
Why does the classloader complain about "Invalid getter or setter"?
{{{ You are probably accessing a field with the wrong access type.
- There are two bytecodes, one to get a static field and one to get a regular field (GETSTATIC and GETFIELD respectively). Make sure you are using the proper access type. }}}
Why does the classloader complain about a field not being accessible? It's a protected member of a superclass!
{{{ You are probably trying to resolve against the class you are
- generating. Make sure you specify the classname that declares the field. For example, if you have a base class named ["AbstractXMLSource"] with a protected member named "m_contentHandler", then your generated class must access "m_contentHandler" using "AbstractXMLSource" as the class name. }}}
Why does the classloader complain about not being able to pop a variable off the stack?
{{{ Don't forget to load the object that you are going to execute a
- method on. You must first load the object, then all the parameters, and then you can call the method. }}}