What is the purpose of not calling JavaCompilerArgumentsBuilder noEmptySourcePath()?

What is the purpose of not calling JavaCompilerArgumentsBuilder#noEmptySourcePath()?

If the source path is empty, then not calling that method will result in:


This results in a command line that considers the next non-whitespace/non-empty arg as the source path, instead of as whatever it really is, which completely destroys the whole command line.

That makes absolutely no sense to me. Maybe some subsequent Gradle code will iterate over args and change the value of the empty value after "-sourcepath", but, if that’s the case, it would be better to not output "-sourcepath" followed by "", and for that hypothetical code to modify anything that follows "-sourcepath", or, if args does not contain "-sourcepath", to insert a "-sourcepath" followed by a non-empty value.

If there’s no purpose in not calling noEmptySourcePath(), shouldn’t it & allowEmptySourcePath be removed?

I just saw that JdkJavaCompiler#createCompileTask(JavaCompileSpec, JdkJavaCompilerResult) checks for an empty String following "-sourcepath", and, if so, uses SourcepathIgnoringProxy.proxy(...), but it still leaves args corrupted with arguments that will shift over by one.

Wouldn’t it make more sense to leave the empty source path out of args, and, instead of using allowEmptySourcePath, use a different boolean that indicates that if !args.contains("-sourcepath"), then use SourcepathIgnoringProxy.proxy(...)?