Closed Lilianne-Blaze closed 9 months ago
if file preprocessed then such comments will be removed automatically and how to be if file not preprocessed but for instance such code snippet cleared of jcp comments?
//#if DEBUG
// Hello debug
System.out.println("Hello debug");
//#else
// No debug
System.out.println("No debug");
//#endif
we will get clean result
// Hello debug
System.out.println("Hello debug");
// No debug
System.out.println("No debug");
how to be in the case?
Basically given that code:
public static long getMyPid() {
System.out.println("(getMyPid called)");
long retVal = 0;
// #if preprocess.java.version >= 9
// use new API
retVal = ProcessHandle.current().pid();
// #else
// use old MXBean hack
// $retVal = getMyPidOld();
// #endif
return retVal;
}
Normally I get this:
public static long getMyPid() {
System.out.println("(getMyPid called)");
long retVal = 0;
// JCP! if preprocess.java.version >= 9
// JCP> // use new API
// JCP> retVal = ProcessHandle.current().pid();
// JCP! else
// use old MXBean hack
retVal = getMyPidOld();
// JCP! endif
return retVal;
}
With keepComments=false I get this:
public static long getMyPid() {
System.out.println("(getMyPid called)");
long retVal = 0;
retVal = getMyPidOld();
return retVal;
}
I would like to get this:
public static long getMyPid() {
System.out.println("(getMyPid called)");
long retVal = 0;
// use old MXBean hack
retVal = getMyPidOld();
return retVal;
}
Something like keepNormalComments or keepNonmacroComments would be nice
ok, I will check
I've made some improvements and now keepComments allows such variants:
keepComments='remove_jcp_only'
Could you please add an option to Maven plugin that allows removing comments but only those that contain JCP macros? So that javadocs and code-explaining comments remain untouched?