Skip to content

Apache Lucene open-source search software

Escape the options in ECJ's options file

Uwe Schindler6941701c6d92
diff --git a/gradle/validation/ecj-lint.gradle b/gradle/validation/ecj-lint.gradle
index 96a6cc57cac..d87b7857158 100644
--- a/gradle/validation/ecj-lint.gradle
+++ b/gradle/validation/ecj-lint.gradle
@@ -65,11 +65,12 @@ allprojects {
// limits. We could pass a directory but ecj seems to be buggy: when it
// encounters a module-info.java file it no longer compiles other source files.
def inputsFile = file("${tmpDst}/ecj-inputs.txt")
+ def escapeOption = { String s -> (s =~ /[ '"]/) ? ('"' + s.replaceAll(/[\\'"]/, /\\$0/) + '"') : s }
inputsFile.setText(
srcDirs.collectMany { dir ->
project.fileTree(dir: dir, include: "**/*.java" ).files
}
- .collect {file -> file.absolutePath.toString()}.join("\n"), "UTF-8")
+ .collect {file -> escapeOption(file.absolutePath.toString())}.join("\n"), "UTF-8")
args += [ "-d", "none" ]