> Sometimes, however, the sheer size of the code base means that refactoring becomes a formidable task—one that verges on being impossible if attempted manually. At that point, an enterprising kernel hacker may well turn to writing code that refactors the [kernel] code.
For Java such code has been written already: (at least) Eclipse does this on a routine basis.
Of course this is a much easier problem since Java has no pre-processor. I'm still impressed seeing it in action.