Skip to content

Commit

Permalink
[sarl-maven-plugin] Avoid warning when 'opimization' parameter is not…
Browse files Browse the repository at this point in the history
… provided in the pom file.

Signed-off-by: Stéphane Galland <galland@arakhne.org>
  • Loading branch information
gallandarakhneorg committed Aug 22, 2018
1 parent 28f946c commit 3fc34bf
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
Expand Up @@ -206,19 +206,21 @@ protected JavaCompiler getJavaCompiler() {
@Override
protected OptimizationLevel getOptimization() {
if (this.optimizationInstance == null) {
this.optimizationInstance = OptimizationLevel.valueOfCaseInsensitive(this.optimization);
if (this.optimizationInstance == null) {
String values = null;
for (final OptimizationLevel lvl : OptimizationLevel.values()) {
if (values == null) {
values = lvl.getCaseInsensitiveName();
} else {
values = MessageFormat.format(Messages.AbstractCompileMojo_1, values,
lvl.getCaseInsensitiveName());
if (!Strings.isNullOrEmpty(this.optimization)) {
this.optimizationInstance = OptimizationLevel.valueOfCaseInsensitive(this.optimization);
if (this.optimizationInstance == null) {
String values = null;
for (final OptimizationLevel lvl : OptimizationLevel.values()) {
if (values == null) {
values = lvl.getCaseInsensitiveName();
} else {
values = MessageFormat.format(Messages.AbstractCompileMojo_1, values,
lvl.getCaseInsensitiveName());
}
}
getLog().warn(MessageFormat.format(Messages.AbstractCompileMojo_2, this.optimization,
values, OptimizationLevel.getDefault().getCaseInsensitiveName()));
}
getLog().warn(MessageFormat.format(Messages.AbstractCompileMojo_2, this.optimization,
values, OptimizationLevel.getDefault().getCaseInsensitiveName()));
}
if (this.optimizationInstance == null) {
this.optimizationInstance = OptimizationLevel.getDefault();
Expand Down
Expand Up @@ -37,6 +37,6 @@ AbstractSarlMojo_4 = Artifact not found in the plugin configuration: {0}
MavenBatchCompiler_0 = Unable to determine the latest version of maven-compiler-plugin. Use the version {0}.
AbstractCompileMojo_0 = The value ''{0}'' is not valid for the parameter 'javaCompiler'. Supported values are {1}. Use ''{2}'' as the default.
AbstractCompileMojo_1 = {0}, {1}
AbstractCompileMojo_2 = The value ''{0}'' is not valid for the parameter 'optimizationLevel'. Supported values are {1}. Use ''{2}'' as the default.
AbstractCompileMojo_2 = The value ''{0}'' is not valid for the parameter 'optimization'. Supported values are {1}. Use ''{2}'' as the default.
Utils_0 = ${project.groupId}
Utils_1 = ${project.artifactId}

0 comments on commit 3fc34bf

Please sign in to comment.