Apache Lucene open-source search software
Apply tidy to gradle scripts (after update of spotless). #16487
Dawid Weiss0110518d8047
diff --git a/build-tools/build-infra-shadow/build.gradle b/build-tools/build-infra-shadow/build.gradleindex 54d5d21055f..f28848fa4e3 100644--- a/build-tools/build-infra-shadow/build.gradle+++ b/build-tools/build-infra-shadow/build.gradle@@ -29,7 +29,7 @@ apply from: rootProject.file("build-tools/build-infra/declare-dependencies.gradldependencies {// seems to be required by gradle apis, otherwise compilation fails even though// we don't use it.- compileOnly ("com.google.code.findbugs:findbugs-annotations:3.0.1")+ compileOnly("com.google.code.findbugs:findbugs-annotations:3.0.1")}tasks.matching {diff --git a/lucene/analysis/common/build.gradle b/lucene/analysis/common/build.gradleindex 806827cb4c6..f9c0a9fb7eb 100644--- a/lucene/analysis/common/build.gradle+++ b/lucene/analysis/common/build.gradle@@ -40,12 +40,12 @@ def snowballStemmerCommit = "2d2e312df56f2ede014a4ffb3e91e6dea43c24be"// git commit hash of stopwords https://github.com/snowballstem/snowball-websitedef snowballWebsiteCommit = "424fd1f75044160bb4a92f1daf08cce618459374"-def snowballWorkDir = file("${buildDir}/snowball")+def snowballWorkDir = file("${buildDir}/snowball")def snowballStemmerDir = file("${snowballWorkDir}/stemmers-${snowballStemmerCommit}")def snowballWebsiteDir = file("${snowballWorkDir}/website-${snowballWebsiteCommit}")-def snowballScript = file("${resources}/snowball.sh")+def snowballScript = file("${resources}/snowball.sh")def unpackFromZip = { zipFile, targetDir ->buildGlobals.fileOps.sync({SyncSpec spec ->@@ -98,17 +98,17 @@ tasks.register("regenerateSnowball", QuietExec, {}inputs.files fileTree(- dir: "src/java/org/tartarus/snowball",- include: [- "Among.java",- "SnowballStemmer.java",- "SnowballProgram.java",- "ext/*Stemmer.java"- ])+ dir: "src/java/org/tartarus/snowball",+ include: [+ "Among.java",+ "SnowballStemmer.java",+ "SnowballProgram.java",+ "ext/*Stemmer.java"+ ])inputs.files fileTree(- dir: "src/resources/org/apache/lucene/analysis/snowball",- include: "*_stop.txt")+ dir: "src/resources/org/apache/lucene/analysis/snowball",+ include: "*_stop.txt")// Don't bother on Windows, won't work.if (Os.isFamily(Os.FAMILY_WINDOWS)) {@@ -232,7 +232,9 @@ if (testRegressionsOption.get()) {tasks.withType(Test).configureEach {dependsOn cloningTasksinputs.dir cloneDirProperty- systemProperty "hunspell.dictionaries", cloneDirProperty.map { dir -> dir.asFile.absolutePath }.get()+ systemProperty "hunspell.dictionaries", cloneDirProperty.map { dir ->+ dir.asFile.absolutePath+ }.get()}}diff --git a/lucene/analysis/icu/build.gradle b/lucene/analysis/icu/build.gradleindex edacc185779..b8c4ecbed1a 100644--- a/lucene/analysis/icu/build.gradle+++ b/lucene/analysis/icu/build.gradle@@ -65,7 +65,7 @@ def icupkgif (Os.isFamily(Os.FAMILY_WINDOWS)) {icuBinDir = file("${icuBuildDir}/bin64")gennorm = file("${icuBinDir}/gennorm2.exe")- icupkg = file("${icuBinDir}/icupkg.exe")+ icupkg = file("${icuBinDir}/icupkg.exe")} else {icuBinDir = file("${icuBuildDir}/icu/source/bin")gennorm = file("${icuBinDir}/gennorm2")diff --git a/lucene/benchmark-jmh/build.gradle b/lucene/benchmark-jmh/build.gradleindex 6d64bb7a4f7..4380c620ba2 100644--- a/lucene/benchmark-jmh/build.gradle+++ b/lucene/benchmark-jmh/build.gradle@@ -69,10 +69,12 @@ tasks.named("jar").configure {manifest {attributes(["Main-Class": "org.apache.lucene.benchmark.jmh.Main",- "Class-Path": new Object () {+ "Class-Path": new Object() {@OverrideString toString() {- return configurations.runtimeClasspath.collect { f -> f.name }.join(" ")+ return configurations.runtimeClasspath.collect { f ->+ f.name+ }.join(" ")}}])diff --git a/lucene/core/build.gradle b/lucene/core/build.gradleindex aaeda5961f0..97eea60e8a1 100644--- a/lucene/core/build.gradle+++ b/lucene/core/build.gradle@@ -108,11 +108,11 @@ configure(project(":lucene:core")) {doLast {ant.replace(- file: file('src/java/org/apache/lucene/analysis/standard/StandardTokenizerImpl.java'),- encoding: "UTF-8",- token: "private static final int ZZ_BUFFERSIZE =",- value: "private int ZZ_BUFFERSIZE ="- )+ file: file('src/java/org/apache/lucene/analysis/standard/StandardTokenizerImpl.java'),+ encoding: "UTF-8",+ token: "private static final int ZZ_BUFFERSIZE =",+ value: "private int ZZ_BUFFERSIZE ="+ )}})}@@ -217,11 +217,11 @@ configure(project(":lucene:analysis:common")) {doLast {ant.replace(- file: file('src/java/org/apache/lucene/analysis/email/UAX29URLEmailTokenizerImpl.java'),- encoding: "UTF-8",- token: "private static final int ZZ_BUFFERSIZE =",- value: "private int ZZ_BUFFERSIZE ="- )+ file: file('src/java/org/apache/lucene/analysis/email/UAX29URLEmailTokenizerImpl.java'),+ encoding: "UTF-8",+ token: "private static final int ZZ_BUFFERSIZE =",+ value: "private int ZZ_BUFFERSIZE ="+ )}})@@ -245,10 +245,10 @@ configure(project(":lucene:analysis:common")) {doLast {project.ant.fixcrlf(- file: target,- encoding: "UTF-8",- eol: "lf"- )+ file: target,+ encoding: "UTF-8",+ eol: "lf"+ )}})@@ -300,11 +300,11 @@ tasks.register("regeneratePacked64SingleBlock", {}// Correct line endings for Windows.project.ant.fixcrlf(- srcDir: targetDir,- includes: 'Packed64SingleBlock.java, BulkOperation*.java',- encoding: 'UTF-8',- eol: 'lf'- )+ srcDir: targetDir,+ includes: 'Packed64SingleBlock.java, BulkOperation*.java',+ encoding: 'UTF-8',+ eol: 'lf'+ )}})@@ -362,10 +362,10 @@ tasks.register("regenerateParametricDescription", {}}project.ant.fixcrlf(- srcDir: targetDir,- includes: '*ParametricDescription.java',- encoding: 'UTF-8',- eol: 'lf'- )+ srcDir: targetDir,+ includes: '*ParametricDescription.java',+ encoding: 'UTF-8',+ eol: 'lf'+ )}})diff --git a/lucene/luke/build.gradle b/lucene/luke/build.gradleindex c25c2e48b3a..40bec721dce 100644--- a/lucene/luke/build.gradle+++ b/lucene/luke/build.gradle@@ -110,12 +110,12 @@ def standaloneAssembleTask = tasks.register("standaloneAssemble", Sync, {doLast {logger.lifecycle(- """+ """Standalone Luke distribution assembled. You can run it with:java -jar "${standaloneDistDir}/${standaloneJarName}"java --module-path "${standaloneDistDir}" -m org.apache.lucene.luke"""- )+ )}})@@ -144,10 +144,10 @@ tasks.register("run", {doFirst {logger.lifecycle("Launching Luke ${project.version} right now...")ant.exec(- executable: rootProject.getExtensions().getByType(AlternativeJdkSupportPlugin.AltJvmExtension).compilationJvm.get().javaExecutable.toString(),- spawn: true,- vmlauncher: true- ) {+ executable: rootProject.getExtensions().getByType(AlternativeJdkSupportPlugin.AltJvmExtension).compilationJvm.get().javaExecutable.toString(),+ spawn: true,+ vmlauncher: true+ ) {arg(value: '-jar')arg(value: file("${standaloneDistDir}/${standaloneJar.archiveFileName.get()}").absolutePath)}diff --git a/lucene/queryparser/build.gradle b/lucene/queryparser/build.gradleindex 228ad8fba89..f1e563e420f 100644--- a/lucene/queryparser/build.gradle+++ b/lucene/queryparser/build.gradle@@ -36,8 +36,8 @@ def commonCleanups = { FileTree generatedFiles ->generatedFiles.matching({include "CharStream.java"}).each {file ->buildGlobals.modifyFile(file, {text ->return text.replace(- "implemetation", // spellchecker:disable-line- "implementation");+ "implemetation", // spellchecker:disable-line+ "implementation");})}@@ -55,33 +55,33 @@ def commonCleanups = { FileTree generatedFiles ->buildGlobals.modifyFile(file, {text ->// Remove redundant imports.text = text.replaceAll(- /(?m)^import .+/,- "")+ /(?m)^import .+/,+ "")// Add CharStream imports.text = text.replaceAll(- /package (.+)/,- '''+ /package (.+)/,+ '''package $1import org.apache.lucene.queryparser.charstream.CharStream;'''.trim())// Eliminates redundant cast message.text = text.replace(- "int hiByte = (int)(curChar >> 8);",- "int hiByte = curChar >> 8;")+ "int hiByte = (int)(curChar >> 8);",+ "int hiByte = curChar >> 8;")// Access to forbidden APIs.text = text.replace(- "public java.io.PrintStream debugStream = System.out;",- "// (debugStream omitted).")+ "public java.io.PrintStream debugStream = System.out;",+ "// (debugStream omitted).")text = text.replace(- "public void setDebugStream(java.io.PrintStream ds) { debugStream = ds; }",- "// (setDebugStream omitted).")+ "public void setDebugStream(java.io.PrintStream ds) { debugStream = ds; }",+ "// (setDebugStream omitted).")// Remove dangling doc commentstext = text.replace(- "/** Debug output. */",- "// Debug output.")+ "/** Debug output. */",+ "// Debug output.")text = text.replace(- "/** Set debug output. */",- "// Set debug output.")+ "/** Set debug output. */",+ "// Set debug output.")return text})}@@ -106,26 +106,26 @@ tasks.register("regenerateClassicQueryParser", JavaCCTask, {generatedFiles.matching {include "QueryParser.java"}.each {file ->buildGlobals.modifyFile(file, {text ->text = text.replace(- "public QueryParser(CharStream ",- "protected QueryParser(CharStream ")+ "public QueryParser(CharStream ",+ "protected QueryParser(CharStream ")text = text.replace(- "public QueryParser(QueryParserTokenManager ",- "protected QueryParser(QueryParserTokenManager ")+ "public QueryParser(QueryParserTokenManager ",+ "protected QueryParser(QueryParserTokenManager ")text = text.replace(- "new java.util.ArrayList<int[]>",- "new java.util.ArrayList<>")+ "new java.util.ArrayList<int[]>",+ "new java.util.ArrayList<>")text = text.replace(- "final private LookaheadSuccess jj_ls =",- "static final private LookaheadSuccess jj_ls =")+ "final private LookaheadSuccess jj_ls =",+ "static final private LookaheadSuccess jj_ls =")text = text.replace(- "public class QueryParser ",- '@SuppressWarnings({"unused","null"}) public class QueryParser ')+ "public class QueryParser ",+ '@SuppressWarnings({"unused","null"}) public class QueryParser ')text = text.replace(- "final public Query TopLevelQuery(",- "@Override final public Query TopLevelQuery(")+ "final public Query TopLevelQuery(",+ "@Override final public Query TopLevelQuery(")text = text.replace(- "public void ReInit(CharStream ",- "@Override public void ReInit(CharStream ")+ "public void ReInit(CharStream ",+ "@Override public void ReInit(CharStream ")return text})}@@ -145,14 +145,14 @@ tasks.register("regenerateSurroundQueryParser", JavaCCTask, {generatedFiles.matching {include "QueryParser.java"}.each {file ->buildGlobals.modifyFile(file, {text ->text = text.replace(- "import org.apache.lucene.analysis.TokenStream;",- "")+ "import org.apache.lucene.analysis.TokenStream;",+ "")text = text.replace(- "new java.util.ArrayList<int[]>",- "new java.util.ArrayList<>")+ "new java.util.ArrayList<int[]>",+ "new java.util.ArrayList<>")text = text.replace(- "public class QueryParser ",- '@SuppressWarnings({"unused","null"}) public class QueryParser ')+ "public class QueryParser ",+ '@SuppressWarnings({"unused","null"}) public class QueryParser ')return text})}@@ -172,12 +172,12 @@ tasks.register("regenerateFlexibleStandardSyntaxParser", JavaCCTask, {buildGlobals.modifyFile(file, {text ->// Modify constructor.text = text.replace(- "class ParseException extends Exception",- "class ParseException extends QueryNodeParseException")+ "class ParseException extends Exception",+ "class ParseException extends QueryNodeParseException")// Modify imports.text = text.replace(- "package org.apache.lucene.queryparser.flexible.standard.parser;", '''\+ "package org.apache.lucene.queryparser.flexible.standard.parser;", '''\package org.apache.lucene.queryparser.flexible.standard.parser;import org.apache.lucene.queryparser.flexible.core.QueryNodeParseException;@@ -188,7 +188,7 @@ tasks.register("regenerateFlexibleStandardSyntaxParser", JavaCCTask, {// Modify constructors and code bitstext = text.replaceAll(- /(?s)[ ]*public ParseException\(Token currentTokenVal[^}]+[}]/, '''\+ /(?s)[ ]*public ParseException\(Token currentTokenVal[^}]+[}]/, '''\public ParseException(Token currentTokenVal,int[][] expectedTokenSequencesVal, String[] tokenImageVal){@@ -201,7 +201,7 @@ tasks.register("regenerateFlexibleStandardSyntaxParser", JavaCCTask, {''')text = text.replaceAll(- /(?s)[ ]*public ParseException\(String message\)[^}]+[}]/, '''\+ /(?s)[ ]*public ParseException\(String message\)[^}]+[}]/, '''\public ParseException(Message message){super(message);@@ -209,7 +209,7 @@ tasks.register("regenerateFlexibleStandardSyntaxParser", JavaCCTask, {''')text = text.replaceAll(- /(?s)[ ]*public ParseException\(\)[^}]+[}]/, '''\+ /(?s)[ ]*public ParseException\(\)[^}]+[}]/, '''\public ParseException(){super(new MessageImpl(QueryParserMessages.INVALID_SYNTAX, "Error"));@@ -223,17 +223,17 @@ tasks.register("regenerateFlexibleStandardSyntaxParser", JavaCCTask, {buildGlobals.modifyFile(file, {text ->// Remove redundant casttext = text.replace(- "new java.util.ArrayList<int[]>",- "new java.util.ArrayList<>")+ "new java.util.ArrayList<int[]>",+ "new java.util.ArrayList<>")text = text.replace(- "new ArrayList<QueryNode>()",- "new ArrayList<>()")+ "new ArrayList<QueryNode>()",+ "new ArrayList<>()")text = text.replace(- "Collections.<QueryNode> singletonList",- "Collections.singletonList")+ "Collections.<QueryNode> singletonList",+ "Collections.singletonList")text = text.replace(- "public class StandardSyntaxParser ",- '@SuppressWarnings({"unused","null"}) public class StandardSyntaxParser ')+ "public class StandardSyntaxParser ",+ '@SuppressWarnings({"unused","null"}) public class StandardSyntaxParser ')return text})}diff --git a/lucene/test-framework/build.gradle b/lucene/test-framework/build.gradleindex 0b5ea333521..8f4a3f57d1d 100644--- a/lucene/test-framework/build.gradle+++ b/lucene/test-framework/build.gradle@@ -22,10 +22,10 @@ description = 'Framework for testing Lucene-based applications'dependencies {moduleApi project(':lucene:core')- moduleApi (deps.randomizedtesting.runner, {+ moduleApi(deps.randomizedtesting.runner, {exclude group: "junit"})- moduleApi (deps.junit, {+ moduleApi(deps.junit, {exclude group: "org.hamcrest"})moduleApi deps.hamcrest