diff --git a/compiler/cli/cli-common/src/org/jetbrains/jet/cli/common/arguments/CommonArgumentConstants.java b/compiler/cli/cli-common/src/org/jetbrains/jet/cli/common/arguments/CommonArgumentConstants.java deleted file mode 100644 index 6f7d85b7ba4..00000000000 --- a/compiler/cli/cli-common/src/org/jetbrains/jet/cli/common/arguments/CommonArgumentConstants.java +++ /dev/null @@ -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"; -} diff --git a/compiler/cli/cli-common/src/org/jetbrains/jet/cli/common/arguments/CommonCompilerArguments.java b/compiler/cli/cli-common/src/org/jetbrains/jet/cli/common/arguments/CommonCompilerArguments.java index dbc649a2e50..a861b1e2956 100644 --- a/compiler/cli/cli-common/src/org/jetbrains/jet/cli/common/arguments/CommonCompilerArguments.java +++ b/compiler/cli/cli-common/src/org/jetbrains/jet/cli/common/arguments/CommonCompilerArguments.java @@ -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 freeArgs = new SmartList(); - public boolean suppressAllWarnings() { - return SUPPRESS_WARNINGS.equalsIgnoreCase(suppress); - } - @NotNull public String executableScriptFileName() { return "kotlinc"; diff --git a/compiler/cli/src/org/jetbrains/jet/cli/common/CLICompiler.java b/compiler/cli/src/org/jetbrains/jet/cli/common/CLICompiler.java index f36acbd4795..8f41772ed2f 100644 --- a/compiler/cli/src/org/jetbrains/jet/cli/common/CLICompiler.java +++ b/compiler/cli/src/org/jetbrains/jet/cli/common/CLICompiler.java @@ -109,7 +109,7 @@ public abstract class CLICompiler { MessageCollector collector = new PrintingMessageCollector(errStream, messageRenderer, arguments.verbose); - if (arguments.suppressAllWarnings()) { + if (arguments.suppressWarnings) { collector = new FilteringMessageCollector(collector, Predicates.equalTo(CompilerMessageSeverity.WARNING)); } diff --git a/compiler/testData/cli/js/jsHelp.out b/compiler/testData/cli/js/jsHelp.out index c160669be38..c23c79f5978 100644 --- a/compiler/testData/cli/js/jsHelp.out +++ b/compiler/testData/cli/js/jsHelp.out @@ -7,10 +7,10 @@ where possible options include: -main {call,noCall} Whether a main function should be called; default 'call' (main function will be auto detected) -output-prefix Path to file which will be added to the beginning of output file -output-postfix Path to file which will be added to the end of output file + -nowarn Generate no warnings -tags Demarcate each compilation message (error, warning, etc) with an open and close tag -verbose Enable verbose logging output -version Display compiler version -help (-h) Print a synopsis of standard options - -suppress warnings Suppress all compiler warnings -X Print a synopsis of advanced options OK \ No newline at end of file diff --git a/compiler/testData/cli/js/suppressAllWarningsJS.args b/compiler/testData/cli/js/suppressAllWarningsJS.args index 2e51d88027b..b8ca87aa49f 100644 --- a/compiler/testData/cli/js/suppressAllWarningsJS.args +++ b/compiler/testData/cli/js/suppressAllWarningsJS.args @@ -1,5 +1,4 @@ $TESTDATA_DIR$/../warnings.kt --suppress -WaRnInGs +-nowarn -output $TEMP_DIR$/out.js diff --git a/compiler/testData/cli/jvm/help.out b/compiler/testData/cli/jvm/help.out index c4492e71b4a..31b661d85e1 100644 --- a/compiler/testData/cli/jvm/help.out +++ b/compiler/testData/cli/jvm/help.out @@ -10,10 +10,10 @@ where possible options include: -module Path to the module file to compile -script Evaluate the script file -kotlin-home Path to Kotlin compiler home directory, used for annotations and runtime libraries discovery + -nowarn Generate no warnings -tags Demarcate each compilation message (error, warning, etc) with an open and close tag -verbose Enable verbose logging output -version Display compiler version -help (-h) Print a synopsis of standard options - -suppress warnings Suppress all compiler warnings -X Print a synopsis of advanced options OK \ No newline at end of file diff --git a/compiler/testData/cli/jvm/suppressAllWarningsLowercase.args b/compiler/testData/cli/jvm/suppressAllWarningsJvm.args similarity index 69% rename from compiler/testData/cli/jvm/suppressAllWarningsLowercase.args rename to compiler/testData/cli/jvm/suppressAllWarningsJvm.args index ce6db8c95ce..d7fcd6dbd9c 100644 --- a/compiler/testData/cli/jvm/suppressAllWarningsLowercase.args +++ b/compiler/testData/cli/jvm/suppressAllWarningsJvm.args @@ -1,5 +1,4 @@ $TESTDATA_DIR$/../warnings.kt --suppress -warnings +-nowarn -d $TEMP_DIR$ diff --git a/compiler/testData/cli/jvm/suppressAllWarningsLowercase.out b/compiler/testData/cli/jvm/suppressAllWarningsJvm.out similarity index 100% rename from compiler/testData/cli/jvm/suppressAllWarningsLowercase.out rename to compiler/testData/cli/jvm/suppressAllWarningsJvm.out diff --git a/compiler/testData/cli/jvm/suppressAllWarningsMixedCase.args b/compiler/testData/cli/jvm/suppressAllWarningsMixedCase.args deleted file mode 100644 index d10a31176c5..00000000000 --- a/compiler/testData/cli/jvm/suppressAllWarningsMixedCase.args +++ /dev/null @@ -1,5 +0,0 @@ -$TESTDATA_DIR$/../warnings.kt --suppress -WaRnInGs --d -$TEMP_DIR$ diff --git a/compiler/testData/cli/jvm/suppressAllWarningsMixedCase.out b/compiler/testData/cli/jvm/suppressAllWarningsMixedCase.out deleted file mode 100644 index d86bac9de59..00000000000 --- a/compiler/testData/cli/jvm/suppressAllWarningsMixedCase.out +++ /dev/null @@ -1 +0,0 @@ -OK diff --git a/compiler/testData/cli/jvm/wrongArgument.out b/compiler/testData/cli/jvm/wrongArgument.out index fd67ab44bae..cb7e8baa86b 100644 --- a/compiler/testData/cli/jvm/wrongArgument.out +++ b/compiler/testData/cli/jvm/wrongArgument.out @@ -11,10 +11,10 @@ where possible options include: -module Path to the module file to compile -script Evaluate the script file -kotlin-home Path to Kotlin compiler home directory, used for annotations and runtime libraries discovery + -nowarn Generate no warnings -tags Demarcate each compilation message (error, warning, etc) with an open and close tag -verbose Enable verbose logging output -version Display compiler version -help (-h) Print a synopsis of standard options - -suppress warnings Suppress all compiler warnings -X Print a synopsis of advanced options INTERNAL_ERROR \ No newline at end of file diff --git a/compiler/tests/org/jetbrains/jet/cli/CliCommonTest.java b/compiler/tests/org/jetbrains/jet/cli/CliCommonTest.java index 3b40111672f..20999a6f6a5 100644 --- a/compiler/tests/org/jetbrains/jet/cli/CliCommonTest.java +++ b/compiler/tests/org/jetbrains/jet/cli/CliCommonTest.java @@ -52,12 +52,7 @@ public class CliCommonTest extends CliBaseTest { } @Test - public void suppressAllWarningsLowercase() throws Exception { - executeCompilerCompareOutputJVM(); - } - - @Test - public void suppressAllWarningsMixedCase() throws Exception { + public void suppressAllWarningsJvm() throws Exception { executeCompilerCompareOutputJVM(); } diff --git a/compiler/tests/org/jetbrains/jet/cli/KotlincExecutableTestGenerated.java b/compiler/tests/org/jetbrains/jet/cli/KotlincExecutableTestGenerated.java index e0708dafba3..624ac7ec61d 100644 --- a/compiler/tests/org/jetbrains/jet/cli/KotlincExecutableTestGenerated.java +++ b/compiler/tests/org/jetbrains/jet/cli/KotlincExecutableTestGenerated.java @@ -89,14 +89,9 @@ public class KotlincExecutableTestGenerated extends AbstractKotlincExecutableTes doJvmTest("compiler/testData/cli/jvm/simple.args"); } - @TestMetadata("suppressAllWarningsLowercase.args") - public void testSuppressAllWarningsLowercase() throws Exception { - doJvmTest("compiler/testData/cli/jvm/suppressAllWarningsLowercase.args"); - } - - @TestMetadata("suppressAllWarningsMixedCase.args") - public void testSuppressAllWarningsMixedCase() throws Exception { - doJvmTest("compiler/testData/cli/jvm/suppressAllWarningsMixedCase.args"); + @TestMetadata("suppressAllWarningsJvm.args") + public void testSuppressAllWarningsJvm() throws Exception { + doJvmTest("compiler/testData/cli/jvm/suppressAllWarningsJvm.args"); } @TestMetadata("wrongAbiVersion.args") diff --git a/compiler/tests/org/jetbrains/jet/codegen/forTestCompile/ForTestCompileRuntime.java b/compiler/tests/org/jetbrains/jet/codegen/forTestCompile/ForTestCompileRuntime.java index b1a2cd30c1e..5d02b8dea0e 100644 --- a/compiler/tests/org/jetbrains/jet/codegen/forTestCompile/ForTestCompileRuntime.java +++ b/compiler/tests/org/jetbrains/jet/codegen/forTestCompile/ForTestCompileRuntime.java @@ -91,7 +91,7 @@ public class ForTestCompileRuntime { "-d", destDir.getPath(), "-no-stdlib", "-no-jdk-annotations", - "-suppress", "warnings", + "-nowarn", "-annotations", JetTestUtils.getJdkAnnotationsJar().getAbsolutePath(), "-classpath", classPath ); diff --git a/idea/src/org/jetbrains/jet/plugin/compiler/configuration/KotlinCompilerConfigurableTab.java b/idea/src/org/jetbrains/jet/plugin/compiler/configuration/KotlinCompilerConfigurableTab.java index 77864d6b5a3..92bb728abc8 100644 --- a/idea/src/org/jetbrains/jet/plugin/compiler/configuration/KotlinCompilerConfigurableTab.java +++ b/idea/src/org/jetbrains/jet/plugin/compiler/configuration/KotlinCompilerConfigurableTab.java @@ -36,8 +36,6 @@ import org.jetbrains.jet.plugin.JetBundle; import javax.swing.*; -import static org.jetbrains.jet.cli.common.arguments.CommonArgumentConstants.SUPPRESS_WARNINGS; - public class KotlinCompilerConfigurableTab implements SearchableConfigurable, Configurable.NoScroll{ private final CommonCompilerArguments commonCompilerArguments; private final K2JSCompilerArguments k2jsCompilerArguments; @@ -88,7 +86,7 @@ public class KotlinCompilerConfigurableTab implements SearchableConfigurable, Co @Override public boolean isModified() { - return ComparingUtils.isModified(generateNoWarningsCheckBox, isGenerateNoWarnings()) || + return ComparingUtils.isModified(generateNoWarningsCheckBox, commonCompilerArguments.suppressWarnings) || ComparingUtils.isModified(additionalArgsOptionsField, compilerSettings.getAdditionalArguments()) || ComparingUtils.isModified(generateSourceMapsCheckBox, k2jsCompilerArguments.sourceMap) || isModified(outputPrefixFile, k2jsCompilerArguments.outputPrefix) || @@ -97,7 +95,7 @@ public class KotlinCompilerConfigurableTab implements SearchableConfigurable, Co @Override public void apply() throws ConfigurationException { - setGenerateNoWarnings(generateNoWarningsCheckBox.isSelected()); + commonCompilerArguments.suppressWarnings = generateNoWarningsCheckBox.isSelected(); compilerSettings.setAdditionalArguments(additionalArgsOptionsField.getText()); k2jsCompilerArguments.sourceMap = generateSourceMapsCheckBox.isSelected(); k2jsCompilerArguments.outputPrefix = StringUtil.nullize(outputPrefixFile.getText(), true); @@ -106,7 +104,7 @@ public class KotlinCompilerConfigurableTab implements SearchableConfigurable, Co @Override public void reset() { - generateNoWarningsCheckBox.setSelected(isGenerateNoWarnings()); + generateNoWarningsCheckBox.setSelected(commonCompilerArguments.suppressWarnings); additionalArgsOptionsField.setText(compilerSettings.getAdditionalArguments()); generateSourceMapsCheckBox.setSelected(k2jsCompilerArguments.sourceMap); outputPrefixFile.setText(k2jsCompilerArguments.outputPrefix); @@ -129,14 +127,6 @@ public class KotlinCompilerConfigurableTab implements SearchableConfigurable, Co return null; } - private boolean isGenerateNoWarnings() { - return commonCompilerArguments.suppressAllWarnings(); - } - - private void setGenerateNoWarnings(boolean selected) { - commonCompilerArguments.suppress = selected ? SUPPRESS_WARNINGS : null; - } - private static void setupFileChooser( @NotNull JLabel label, @NotNull TextFieldWithBrowseButton fileChooser,