java - Post-compilation custom action over source code? -
i need before compilation process of code *.java
actions on them
applied on target files not source files
for example action
comment system.out.println(""); statements
need output target files generated without print statements
source code files still print statements
note : development under eclipse ide
are sure you’re using right tool task?
it’s simpler use static final boolean variable controlling whether code fragments ought executed. may arrange value compile time constant; in case code disabled via flag not present in resulting byte code. may runtime configuration, e.g.
static final boolean debug = boolean.getboolean("myapp.debug");
…
if(debug) system.out.println(something);
in case command line option -dmyapp.debug=true may enable printout.
there no performance difference between these variants ( , pre-processing approach well). jit smart enough eliminate conditional code @ runtime.
Comments
Post a Comment