Feedback and Possible enhancements
"Stephen Colebourne" <[email protected]>
| Newsgroups | gmane.comp.jakarta.bcel.devel |
|---|---|
| Message-ID | <001b01c21a0a$e03a2fa0$d38127d9@oemcomputer> |
Hi,
I have used BCEL a little bit more now, so I thought I give my feedback on
the slight inconveniences I found.
1) InstructionFactory doesn't have a create method for INSTANCEOF. At first
I assumed 'createCheckCast' would do it.
2) Creating a try catch catch finally was a real pain. It was not obvious
that an exception type of null would create the finally part, and the
arrangement of all the bytecodes seems like something that could be
automated easily. Could I suggest something like:
public class TryCatchFinally extends Instruction {
InstructionList getTryInstructionList();
InstructionList addCatchInstructionList(Type exceptionType);
InstructionList getCatchInstructionList(Type exceptionType);
InstructionList getFinallyInstructionList();
}
The API user would add code to the sub instruction lists, rather than to the
main one. The TryCatchFinally would then be added to the normal
InstructionList. At generation time, the relevant 'glue' code could then be
created (JSR/RET, local variables for the exceptions etc.) In fact, this
pattern could be extended to other block instructions (synchronized, while,
for, etc).
Overall, however the API has been good to work with. Thanks.
Stephen