CLI: change "-suppress warnings" option to "-nowarn"

Following the rule of the least surprise: this option is named "-nowarn" in
other JVM language compilers. Besides, having an option with an argument which
can take exactly one predefined value is sort of confusing
This commit is contained in:
Alexander Udalov
2014-08-01 21:30:35 -05:00
parent cf431ffab0
commit 97e57e3e3d
15 changed files with 17 additions and 73 deletions
@@ -1,21 +0,0 @@
/*
* Copyright 2010-2013 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.jet.cli.common.arguments;
public interface CommonArgumentConstants {
String SUPPRESS_WARNINGS = "warnings";
}
@@ -22,9 +22,10 @@ import org.jetbrains.annotations.NotNull;
import java.util.List;
import static org.jetbrains.jet.cli.common.arguments.CommonArgumentConstants.SUPPRESS_WARNINGS;
public abstract class CommonCompilerArguments {
@Argument(value = "nowarn", description = "Generate no warnings")
public boolean suppressWarnings;
@Argument(value = "tags", description = "Demarcate each compilation message (error, warning, etc) with an open and close tag")
public boolean tags;
@@ -37,19 +38,11 @@ public abstract class CommonCompilerArguments {
@Argument(value = "help", alias = "h", description = "Print a synopsis of standard options")
public boolean help;
@Argument(value = "suppress", description = "Suppress all compiler warnings")
@ValueDescription(SUPPRESS_WARNINGS)
public String suppress;
@Argument(value = "X", description = "Print a synopsis of advanced options")
public boolean extraHelp;
public List<String> freeArgs = new SmartList<String>();
public boolean suppressAllWarnings() {
return SUPPRESS_WARNINGS.equalsIgnoreCase(suppress);
}
@NotNull
public String executableScriptFileName() {
return "kotlinc";
@@ -109,7 +109,7 @@ public abstract class CLICompiler<A extends CommonCompilerArguments> {
MessageCollector collector = new PrintingMessageCollector(errStream, messageRenderer, arguments.verbose);
if (arguments.suppressAllWarnings()) {
if (arguments.suppressWarnings) {
collector = new FilteringMessageCollector(collector, Predicates.equalTo(CompilerMessageSeverity.WARNING));
}