posted 16 years ago
Hi,
In our application, we have a class doing debug-related stuff. Every call to it is supposed to be protected by a check of the value of a particular constant, set by generated code which is different, depending on whether the build is for debug or release purposes. The idea is that a release build will not use, or even load, the debug class.
This works fine, except when people forget to protect their code appropriately. Therefore, I would like to make a little tool, to run during the build process, to check whether we have successfully excluded the debug class.
The approach that currently seems most attractive is to look in each class file to see if there are any bytecodes that refer to the debug class. There shouldn't be any, for a release build.
Is this feasible? What would be the best way to examine the class file?
Any other ideas? I did a very quick program that did a rather dumb examination of the source. It was pretty good at spotting the mistakes, but created quite a lot of false positives (where it thought there was a mistake, but there wasn't really).
Betty Rubble? Well, I would go with Betty... but I'd be thinking of Wilma.