Report warning for non-boolean CLI argument passed multiple times

Only if its values are different, see the test
This commit is contained in:
Alexander Udalov
2017-04-06 16:15:28 +03:00
parent be54e4b93b
commit ff846e787f
17 changed files with 54 additions and 45 deletions
@@ -136,7 +136,7 @@ public abstract class CLICompiler<A extends CommonCompilerArguments> {
messageCollector = new FilteringMessageCollector(messageCollector, Predicate.isEqual(WARNING));
}
reportUnknownAndObsoleteExtraFlags(messageCollector, arguments);
reportArgumentParseProblems(messageCollector, arguments);
GroupingMessageCollector groupingCollector = new GroupingMessageCollector(messageCollector);
@@ -311,7 +311,7 @@ public abstract class CLICompiler<A extends CommonCompilerArguments> {
@NotNull CompilerConfiguration configuration, @NotNull A arguments, @NotNull Services services
);
private void reportUnknownAndObsoleteExtraFlags(@NotNull MessageCollector collector, @NotNull A arguments) {
private void reportArgumentParseProblems(@NotNull MessageCollector collector, @NotNull A arguments) {
for (String flag : arguments.unknownExtraFlags) {
collector.report(STRONG_WARNING, "Flag is not supported by this version of the compiler: " + flag, null);
}
@@ -319,6 +319,10 @@ public abstract class CLICompiler<A extends CommonCompilerArguments> {
collector.report(STRONG_WARNING, "Advanced option value is passed in an obsolete form. Please use the '=' character " +
"to specify the value: " + argument + "=...", null);
}
for (Map.Entry<String, String> argument : arguments.duplicateArguments.entrySet()) {
collector.report(STRONG_WARNING, "Argument " + argument.getKey() + " is passed multiple times. " +
"Only the last value will be used: " + argument.getValue(), null);
}
}
@NotNull