I know all of the philosophical arguments against preprocessors and macros in Java. I don't agree that just because some may abuse a language feature, it should be excluded for all.
I would like to include __FILE__
and __LINE__
macros in my Java and Scala code for efficient logging. Any use of Exception is unacceptable because of runtime performance impacts. Those people who argue that logging can be turned off in "production code" should heed the advise of Brian Kernighan:
Removing the error messages "now that the program is working" is like wearing a parachute on the ground, but taking it off once you're in the air.
Is there any possibility that these macros might make it into the language? If not, is there any way to run a preprocessor like m4 using Maven?
Thanks.