Skip to content

Commit cf27e3e

Browse files
committed
Merge pull request #36971 from omaryaya
* pr/36971: Polish "Avoid setting null compiler option" Avoid setting null compiler option Closes gh-36971
2 parents fe12e75 + 0271efa commit cf27e3e

File tree

1 file changed

+11
-4
lines changed
  • spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven

1 file changed

+11
-4
lines changed

spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/AbstractAotMojo.java

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
*
5454
* @author Phillip Webb
5555
* @author Scott Frederick
56+
* @author Omar YAYA
5657
* @since 3.0.0
5758
*/
5859
public abstract class AbstractAotMojo extends AbstractDependencyFilterMojo {
@@ -152,10 +153,16 @@ protected final void compileSourceFiles(URL[] classPath, File sourcesDirectory,
152153
options.add(releaseVersion);
153154
}
154155
else {
155-
options.add("--source");
156-
options.add(compilerConfiguration.getSourceMajorVersion());
157-
options.add("--target");
158-
options.add(compilerConfiguration.getTargetMajorVersion());
156+
String source = compilerConfiguration.getSourceMajorVersion();
157+
if (source != null) {
158+
options.add("--source");
159+
options.add(source);
160+
}
161+
String target = compilerConfiguration.getTargetMajorVersion();
162+
if (target != null) {
163+
options.add("--target");
164+
options.add(target);
165+
}
159166
}
160167
options.addAll(new RunArguments(this.compilerArguments).getArgs());
161168
Iterable<? extends JavaFileObject> compilationUnits = fileManager.getJavaFileObjectsFromPaths(sourceFiles);

0 commit comments

Comments
 (0)