On my main project, I develop a java servlet project that runs under Tomcat. Most of the code is actually Jython, meaning basically python 2.7. The servlets themselves are written in java, but they instantiate my jython classes and call methods on them (and in a few cases, the jython code calls methods on Java objects).
Oracle open-sourced the jdk, but they maintained control of the javax namespace. Parts of servlet operations depend on it, but it couldn't be used anymore for open-source projects. The arrangement that was finally agreed to was to transfer those servlet-required parts to the jakarta namespace, which is controlled by Apache.
Now all of us servlet developers have a problem. For Tomcat 10+ we have to use jakarta, for Tomcat pre-10, we have to use javax. And in java you can't do conditional imports as we do with Python in Leo. I can't tell my users to switch to v10, and I can't make them stay with v9. What to do?
OK, compile one way for pre-v9 users and another for post-v10 ones. Yes, but how to handle the repo, since we'll need to propagate changes to both branches. Some people proposed binary editing of the compiled code, and apparently it can be done. Yuck! In C/C++, you would presumably use an IFDEF for the preprocessor.
Instead, I changed my servlet .java files into templates with replaceable namespace parameters. My build system expects you to type the target namespace on the command line; it will use that to create the actual .java file from the template, and then build with the result of that.
It works well enough, but I wish we could do conditional imports with java!