From 0bb00c9a43cae4f6904819945c1a664daaf2f787 Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Thu, 16 Jan 2020 23:10:47 -0800 Subject: [PATCH] Compile with Java with the '-parameters' option Update the `ConventionsPlugin` to apply the `-parameters` compiler argument. Closes gh-19784 --- .../springframework/boot/build/ConventionsPlugin.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/buildSrc/src/main/java/org/springframework/boot/build/ConventionsPlugin.java b/buildSrc/src/main/java/org/springframework/boot/build/ConventionsPlugin.java index cd8a782286..c5797941a2 100644 --- a/buildSrc/src/main/java/org/springframework/boot/build/ConventionsPlugin.java +++ b/buildSrc/src/main/java/org/springframework/boot/build/ConventionsPlugin.java @@ -16,6 +16,7 @@ package org.springframework.boot.build; +import java.util.List; import java.util.Map; import java.util.TreeMap; @@ -104,7 +105,13 @@ public class ConventionsPlugin implements Plugin { project.getPlugins().withType(JavaPlugin.class, (java) -> { configureSpringJavaFormat(project); project.setProperty("sourceCompatibility", "1.8"); - project.getTasks().withType(JavaCompile.class, (compile) -> compile.getOptions().setEncoding("UTF-8")); + project.getTasks().withType(JavaCompile.class, (compile) -> { + compile.getOptions().setEncoding("UTF-8"); + List args = compile.getOptions().getCompilerArgs(); + if (!args.contains("-parameters")) { + args.add("-parameters"); + } + }); project.getTasks().withType(Javadoc.class, (javadoc) -> javadoc.getOptions().source("1.8").encoding("UTF-8")); project.getTasks().withType(Test.class, (test) -> {