We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Many C and C++ developers rely heavily on the C preprocessor, and lament the lack of a preprocessor in Java, scripting languages, and other programming languages. The principal objection to a preprocessor is that it makes one's code difficult to read. This is indeed true for the C preprocessor. It is sometimes difficult to determine which lines of code are active and which are not. The PreprocessorWizard (rtbaileyphd.com/preprocessorwizard) multi-language WYSIWIG preprocessor resolves the problem of code being difficult to read and allows one preprocessing syntax for all languages. WYSIWIG means the PreprocessorWizard commentizes inactive code and replaces the original source code file with the commentized file (after copying the original to a backup dir). That makes the inactive lines very easy to spot; i.e., what you see is what you get. Given the WYSIWIG approach, PreprocessorWizard is even useful for C/C++ programmers. For C/C++ programmers, code riddled with C preprocessor directives can become absolutely horrendous. That is why one group has developed the Coan tool ("The C Preprocessor Chainsaw") for dealing with such code. See http://coan2.sourceforge.net/index.php for an example of what I mean. With a WYSIWG preprocessor such as PreprocessorWizard, such a tool might not be required. What is or is not active would be very easy to detect, especially with a color-coding editor. The PreprocessorWizard directives can be used in parallel with standard C/C++ preprocessor directives. The PreprocessorWizard requires Perl, but Perl is easy to get and install if you do not already have it; e.g. at ActiveState for Windows. The PreprocessorWizard is easy to use as a standalone application and it can also be easily integrated with almost any IDE.
Comments
I use the PreprocessorWizard in NetBeans and apply it not only to my *.java files, but also my project.properties file. The latter allows me to build from a single application different versions for different customers and put the different versions in different jar files in different directories. I just need to change a line in a config file and I automatically get the version I want in the place I want it when I click "Clean & Build". The code I don't want for a specific customer is commentized and so that customer's jar file bytecode would not contain that code and could not be decompiled by that customer to see what he is missing.