Skip to content

Commit 0bb00c9

Browse files
committed
Compile with Java with the '-parameters' option
Update the `ConventionsPlugin` to apply the `-parameters` compiler argument. Closes gh-19784
1 parent abad007 commit 0bb00c9

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

buildSrc/src/main/java/org/springframework/boot/build/ConventionsPlugin.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
package org.springframework.boot.build;
1818

19+
import java.util.List;
1920
import java.util.Map;
2021
import java.util.TreeMap;
2122

@@ -104,7 +105,13 @@ private void applyJavaConventions(Project project) {
104105
project.getPlugins().withType(JavaPlugin.class, (java) -> {
105106
configureSpringJavaFormat(project);
106107
project.setProperty("sourceCompatibility", "1.8");
107-
project.getTasks().withType(JavaCompile.class, (compile) -> compile.getOptions().setEncoding("UTF-8"));
108+
project.getTasks().withType(JavaCompile.class, (compile) -> {
109+
compile.getOptions().setEncoding("UTF-8");
110+
List<String> args = compile.getOptions().getCompilerArgs();
111+
if (!args.contains("-parameters")) {
112+
args.add("-parameters");
113+
}
114+
});
108115
project.getTasks().withType(Javadoc.class,
109116
(javadoc) -> javadoc.getOptions().source("1.8").encoding("UTF-8"));
110117
project.getTasks().withType(Test.class, (test) -> {

0 commit comments

Comments
 (0)