diff --git a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java index 8737e370ce9..72d8940bc62 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java @@ -240,8 +240,7 @@ public interface Errors { DiagnosticFactory0 MANY_COMPANION_OBJECTS = DiagnosticFactory0.create(ERROR, COMPANION_OBJECT); - DiagnosticFactory1 DEPRECATED_SYMBOL = DiagnosticFactory1.create(WARNING); - DiagnosticFactory2 DEPRECATED_SYMBOL_WITH_MESSAGE = DiagnosticFactory2.create(WARNING); + DiagnosticFactory2 DEPRECATION = DiagnosticFactory2.create(WARNING); // Objects diff --git a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java index e82cc79fa45..84483c4ff80 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java @@ -292,8 +292,7 @@ public class DefaultErrorMessages { MAP.put(MANY_COMPANION_OBJECTS, "Only one companion object is allowed per class"); - MAP.put(DEPRECATED_SYMBOL, "''{0}'' is deprecated.", DEPRECATION_RENDERER); - MAP.put(DEPRECATED_SYMBOL_WITH_MESSAGE, "''{0}'' is deprecated. {1}", DEPRECATION_RENDERER, STRING); + MAP.put(DEPRECATION, "''{0}'' is deprecated. {1}", DEPRECATION_RENDERER, STRING); MAP.put(LOCAL_OBJECT_NOT_ALLOWED, "Named object ''{0}'' is a singleton and cannot be local. Try to use anonymous object instead", NAME); MAP.put(LOCAL_INTERFACE_NOT_ALLOWED, "''{0}'' is an interface so it cannot be local. Try to use anonymous object or abstract class instead", NAME); diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/validation/DeprecatedSymbolValidator.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/validation/DeprecatedSymbolValidator.kt index 930829a1f08..de7ba45bd20 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/validation/DeprecatedSymbolValidator.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/validation/DeprecatedSymbolValidator.kt @@ -23,6 +23,9 @@ import org.jetbrains.kotlin.builtins.KotlinBuiltIns import org.jetbrains.kotlin.descriptors.* import org.jetbrains.kotlin.descriptors.annotations.AnnotationDescriptor import org.jetbrains.kotlin.descriptors.annotations.AnnotationUseSiteTarget +import org.jetbrains.kotlin.descriptors.annotations.AnnotationUseSiteTarget.PROPERTY_GETTER +import org.jetbrains.kotlin.descriptors.annotations.AnnotationUseSiteTarget.PROPERTY_SETTER +import org.jetbrains.kotlin.descriptors.annotations.Annotations import org.jetbrains.kotlin.diagnostics.Diagnostic import org.jetbrains.kotlin.diagnostics.Errors import org.jetbrains.kotlin.lexer.JetTokens @@ -30,9 +33,6 @@ import org.jetbrains.kotlin.name.FqName import org.jetbrains.kotlin.psi.* import org.jetbrains.kotlin.resolve.BindingTrace import org.jetbrains.kotlin.resolve.annotations.argumentValue -import org.jetbrains.kotlin.descriptors.annotations.AnnotationUseSiteTarget.PROPERTY_GETTER -import org.jetbrains.kotlin.descriptors.annotations.AnnotationUseSiteTarget.PROPERTY_SETTER -import org.jetbrains.kotlin.descriptors.annotations.Annotations import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall public class DeprecatedSymbolValidator : SymbolUsageValidator { @@ -116,11 +116,8 @@ public class DeprecatedSymbolValidator : SymbolUsageValidator { } private fun createDeprecationDiagnostic(element: PsiElement, descriptor: DeclarationDescriptor, deprecated: AnnotationDescriptor): Diagnostic { - val message = deprecated.argumentValue("message") as? String - return if (message == null) - Errors.DEPRECATED_SYMBOL.on(element, descriptor.original) - else - Errors.DEPRECATED_SYMBOL_WITH_MESSAGE.on(element, descriptor.original, message) + val message = deprecated.argumentValue("message") as? String ?: "" + return Errors.DEPRECATION.on(element, descriptor.original, message) } private val PROPERTY_SET_OPERATIONS = TokenSet.create(JetTokens.EQ, JetTokens.PLUSEQ, JetTokens.MINUSEQ, JetTokens.MULTEQ, diff --git a/compiler/testData/diagnostics/tests/Underscore.kt b/compiler/testData/diagnostics/tests/Underscore.kt index 6cad835e3be..917b084b171 100644 --- a/compiler/testData/diagnostics/tests/Underscore.kt +++ b/compiler/testData/diagnostics/tests/Underscore.kt @@ -1,4 +1,4 @@ -// !DIAGNOSTICS: -DEPRECATED_SYMBOL_WITH_MESSAGE +// !DIAGNOSTICS: -DEPRECATION import kotlin.Deprecated as ___ @@ -13,4 +13,4 @@ fun __(___: Int, y // in backquotes: allowed val `_` = __________ __@ return if (y != null) __(____, y) else __(`_`, ______) -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/deprecated/annotationUsage.kt b/compiler/testData/diagnostics/tests/deprecated/annotationUsage.kt index 286e0580417..f016768d1a3 100644 --- a/compiler/testData/diagnostics/tests/deprecated/annotationUsage.kt +++ b/compiler/testData/diagnostics/tests/deprecated/annotationUsage.kt @@ -4,6 +4,6 @@ annotation class obsolete() @Deprecated("text") annotation class obsoleteWithParam(val text: String) -@obsolete class Obsolete +@obsolete class Obsolete -@obsoleteWithParam("text") class Obsolete2 \ No newline at end of file +@obsoleteWithParam("text") class Obsolete2 diff --git a/compiler/testData/diagnostics/tests/deprecated/componentUsage.kt b/compiler/testData/diagnostics/tests/deprecated/componentUsage.kt index fcc545c6be8..8e2ae53b4c5 100644 --- a/compiler/testData/diagnostics/tests/deprecated/componentUsage.kt +++ b/compiler/testData/diagnostics/tests/deprecated/componentUsage.kt @@ -7,5 +7,5 @@ class Data { } fun use() { - val (x, y) = Data() -} \ No newline at end of file + val (x, y) = Data() +} diff --git a/compiler/testData/diagnostics/tests/deprecated/functionUsage.kt b/compiler/testData/diagnostics/tests/deprecated/functionUsage.kt index b233b286a9c..4c327ea7f50 100644 --- a/compiler/testData/diagnostics/tests/deprecated/functionUsage.kt +++ b/compiler/testData/diagnostics/tests/deprecated/functionUsage.kt @@ -22,28 +22,28 @@ object InvocableHolder { fun invoker() { val invocable = Invocable() - invocable() - InvocableHolder.invocable() + invocable() + InvocableHolder.invocable() } fun block() { - Obsolete() - Obsolete(2) + Obsolete() + Obsolete(2) } -fun expression() = Obsolete() +fun expression() = Obsolete() -fun reflection() = ::Obsolete -fun reflection2() = UsefulClass::member +fun reflection() = ::Obsolete +fun reflection2() = UsefulClass::member class Initializer { - val x = Obsolete() + val x = Obsolete() } @Deprecated("does nothing good") fun Any.doNothing() = this.toString() // "this" should not be marked as deprecated despite it referes to deprecated function class Delegation { - val x by Obsolete() - var y by Obsolete() -} \ No newline at end of file + val x by Obsolete() + var y by Obsolete() +} diff --git a/compiler/testData/diagnostics/tests/deprecated/genericConstructorUsage.kt b/compiler/testData/diagnostics/tests/deprecated/genericConstructorUsage.kt index 5c1feef730b..5c084c26a0f 100644 --- a/compiler/testData/diagnostics/tests/deprecated/genericConstructorUsage.kt +++ b/compiler/testData/diagnostics/tests/deprecated/genericConstructorUsage.kt @@ -5,4 +5,4 @@ open class C() { constructor(p: Int) : this(){} } -class D : C(1) \ No newline at end of file +class D : C(1) diff --git a/compiler/testData/diagnostics/tests/deprecated/imports.kt b/compiler/testData/diagnostics/tests/deprecated/imports.kt index f203536c3c3..3796ae10e20 100644 --- a/compiler/testData/diagnostics/tests/deprecated/imports.kt +++ b/compiler/testData/diagnostics/tests/deprecated/imports.kt @@ -1,8 +1,8 @@ -import C as C2 +import C as C2 @Deprecated("obsolete") class C { fun use() {} } -fun useAlias(c : C2) { c.use() } \ No newline at end of file +fun useAlias(c : C2) { c.use() } diff --git a/compiler/testData/diagnostics/tests/deprecated/iteratorUsage.kt b/compiler/testData/diagnostics/tests/deprecated/iteratorUsage.kt index 62fbe0dda0c..26051b639e5 100644 --- a/compiler/testData/diagnostics/tests/deprecated/iteratorUsage.kt +++ b/compiler/testData/diagnostics/tests/deprecated/iteratorUsage.kt @@ -19,6 +19,6 @@ class Iter2 { } fun use() { - for (x in Iter()) {} - for (x in Iter2()) {} -} \ No newline at end of file + for (x in Iter()) {} + for (x in Iter2()) {} +} diff --git a/compiler/testData/diagnostics/tests/deprecated/javaDeprecated.kt b/compiler/testData/diagnostics/tests/deprecated/javaDeprecated.kt index 7d91ccd38c3..e5f2771f5bc 100644 --- a/compiler/testData/diagnostics/tests/deprecated/javaDeprecated.kt +++ b/compiler/testData/diagnostics/tests/deprecated/javaDeprecated.kt @@ -11,6 +11,6 @@ public class A { // FILE: B.kt -class B(private @property:Deprecated val foo: String) : A() { - override fun getFoo(text: String): String = super.getFoo(text + foo) -} \ No newline at end of file +class B(private @property:Deprecated val foo: String) : A() { + override fun getFoo(text: String): String = super.getFoo(text + foo) +} diff --git a/compiler/testData/diagnostics/tests/deprecated/javaDocDeprecated.kt b/compiler/testData/diagnostics/tests/deprecated/javaDocDeprecated.kt index 4397cee13f4..166f3cdbd85 100644 --- a/compiler/testData/diagnostics/tests/deprecated/javaDocDeprecated.kt +++ b/compiler/testData/diagnostics/tests/deprecated/javaDocDeprecated.kt @@ -15,6 +15,6 @@ public class A { // FILE: B.kt -class B(private val foo: String) : A() { - override fun getFoo(text: String): String = super.getFoo(text + foo) +class B(private val foo: String) : A() { + override fun getFoo(text: String): String = super.getFoo(text + foo) } diff --git a/compiler/testData/diagnostics/tests/deprecated/nestedTypesUsage.kt b/compiler/testData/diagnostics/tests/deprecated/nestedTypesUsage.kt index acc96d7eaec..e961047cb8f 100644 --- a/compiler/testData/diagnostics/tests/deprecated/nestedTypesUsage.kt +++ b/compiler/testData/diagnostics/tests/deprecated/nestedTypesUsage.kt @@ -12,7 +12,7 @@ class TopLevel { } fun useNested() { - val d = TopLevel.Nested.use() - TopLevel.Nested.Nested2() - TopLevel.Nested.CompanionNested2() -} \ No newline at end of file + val d = TopLevel.Nested.use() + TopLevel.Nested.Nested2() + TopLevel.Nested.CompanionNested2() +} diff --git a/compiler/testData/diagnostics/tests/deprecated/objectUsage.kt b/compiler/testData/diagnostics/tests/deprecated/objectUsage.kt index 406bd1c86b5..6f6cccb9cb5 100644 --- a/compiler/testData/diagnostics/tests/deprecated/objectUsage.kt +++ b/compiler/testData/diagnostics/tests/deprecated/objectUsage.kt @@ -11,17 +11,17 @@ class Another { } fun first() { - Another.use() + Another.use() } fun useObject() { - Obsolete.use() - val x = Obsolete + Obsolete.use() + val x = Obsolete } fun useCompanion() { - val d = Another - val x = Another.Companion - Another.Companion.use() - Another.use() -} \ No newline at end of file + val d = Another + val x = Another.Companion + Another.Companion.use() + Another.use() +} diff --git a/compiler/testData/diagnostics/tests/deprecated/propertyUsage.kt b/compiler/testData/diagnostics/tests/deprecated/propertyUsage.kt index 9b4ae13983f..e5585d8a22b 100644 --- a/compiler/testData/diagnostics/tests/deprecated/propertyUsage.kt +++ b/compiler/testData/diagnostics/tests/deprecated/propertyUsage.kt @@ -15,8 +15,8 @@ class PropertyHolder { @Deprecated("text") var name = "String" - val valDelegate by Delegate() - var varDelegate by Delegate() + val valDelegate by Delegate() + var varDelegate by Delegate() public val test1: String = "" @Deprecated("val-getter") get @@ -35,24 +35,24 @@ class PropertyHolder { } fun PropertyHolder.extFunction() { - test2 = "ext" - test1 + test2 = "ext" + test1 } fun fn() { - PropertyHolder().test1 - PropertyHolder().test2 - PropertyHolder().test2 = "" + PropertyHolder().test1 + PropertyHolder().test2 + PropertyHolder().test2 = "" - PropertyHolder().test3 + PropertyHolder().test3 PropertyHolder().test3 = "" PropertyHolder().test4 - PropertyHolder().test4 = "" + PropertyHolder().test4 = "" - val a = PropertyHolder().x - val b = PropertyHolder().name - PropertyHolder().name = "value" + val a = PropertyHolder().x + val b = PropertyHolder().name + PropertyHolder().name = "value" val d = PropertyHolder().valDelegate PropertyHolder().varDelegate = 1 @@ -60,5 +60,5 @@ fun fn() { fun literals() { PropertyHolder::test1 - PropertyHolder::name -} \ No newline at end of file + PropertyHolder::name +} diff --git a/compiler/testData/diagnostics/tests/deprecated/propertyUseSiteTargetedAnnotations.kt b/compiler/testData/diagnostics/tests/deprecated/propertyUseSiteTargetedAnnotations.kt index b5fb8c11012..d4ddefcc765 100644 --- a/compiler/testData/diagnostics/tests/deprecated/propertyUseSiteTargetedAnnotations.kt +++ b/compiler/testData/diagnostics/tests/deprecated/propertyUseSiteTargetedAnnotations.kt @@ -17,15 +17,15 @@ class PropertyHolder { fun fn() { val holder = PropertyHolder() - holder.a1 - holder.a2 - holder.withGetter - holder.withSetter = "A" + holder.a1 + holder.a2 + holder.withGetter + holder.withSetter = "A" } fun literals() { - PropertyHolder::a1 - PropertyHolder::a2 + PropertyHolder::a1 + PropertyHolder::a2 PropertyHolder::withGetter PropertyHolder::withSetter -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/deprecated/typeUsage.kt b/compiler/testData/diagnostics/tests/deprecated/typeUsage.kt index 74e16785b4d..d8bd041ade2 100644 --- a/compiler/testData/diagnostics/tests/deprecated/typeUsage.kt +++ b/compiler/testData/diagnostics/tests/deprecated/typeUsage.kt @@ -10,33 +10,33 @@ open class Obsolete2 @Deprecated("Constructor") constructor() { interface Generic -open class Derived() : Obsolete() +open class Derived() : Obsolete() class Derived2() : Derived() -class TypeParam : Generic<Obsolete> +class TypeParam : Generic<Obsolete> -object Object : Obsolete() +object Object : Obsolete() class Properties { - val x : Obsolete = Obsolete() - var y : Obsolete = Obsolete() + val x : Obsolete = Obsolete() + var y : Obsolete = Obsolete() - var n : Obsolete - get() = Obsolete() + var n : Obsolete + get() = Obsolete() set(value) {} } -fun param(param: Obsolete) { param.use() } +fun param(param: Obsolete) { param.use() } -fun funcParamReceiver(param: Obsolete.()->Unit) { Obsolete().param() } -fun funcParamParam(param: (Obsolete)->Unit) { param(Obsolete()) } -fun funcParamRetVal(param: ()->Obsolete) { param() } +fun funcParamReceiver(param: Obsolete.()->Unit) { Obsolete().param() } +fun funcParamParam(param: (Obsolete)->Unit) { param(Obsolete()) } +fun funcParamRetVal(param: ()->Obsolete) { param() } -fun Obsolete> constraint() {} +fun Obsolete> constraint() {} -fun Obsolete.receiver() {} +fun Obsolete.receiver() {} -fun retVal(): Obsolete = Obsolete() +fun retVal(): Obsolete = Obsolete() -fun nullableRetVal(): Obsolete? = null \ No newline at end of file +fun nullableRetVal(): Obsolete? = null diff --git a/compiler/testData/diagnostics/tests/thisAndSuper/superInExtensionFunctionCall.kt b/compiler/testData/diagnostics/tests/thisAndSuper/superInExtensionFunctionCall.kt index 57fc070a77f..3028af31e6f 100644 --- a/compiler/testData/diagnostics/tests/thisAndSuper/superInExtensionFunctionCall.kt +++ b/compiler/testData/diagnostics/tests/thisAndSuper/superInExtensionFunctionCall.kt @@ -1,6 +1,6 @@ // No supertype at all class A1 { fun test() { - super.identityEquals(null) // Call to an extension function + super.identityEquals(null) // Call to an extension function } -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/testsWithStdLib/annotations/publicField/publicFieldNotOnProperty.kt b/compiler/testData/diagnostics/testsWithStdLib/annotations/publicField/publicFieldNotOnProperty.kt index 7f5ebd1addb..ed8a83014f2 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/annotations/publicField/publicFieldNotOnProperty.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/annotations/publicField/publicFieldNotOnProperty.kt @@ -1,16 +1,16 @@ // !DIAGNOSTICS: -UNUSED_PARAMETER class C { - @kotlin.jvm.publicField constructor(s: String) { + @kotlin.jvm.publicField constructor(s: String) { } - @kotlin.jvm.publicField private fun foo(s: String = "OK") { + @kotlin.jvm.publicField private fun foo(s: String = "OK") { } } -@kotlin.jvm.publicField +@kotlin.jvm.publicField fun foo() { - @kotlin.jvm.publicField val x = "A" -} \ No newline at end of file + @kotlin.jvm.publicField val x = "A" +} diff --git a/compiler/testData/diagnostics/testsWithStdLib/annotations/publicField/publicFieldOnDelegatedProperty.kt b/compiler/testData/diagnostics/testsWithStdLib/annotations/publicField/publicFieldOnDelegatedProperty.kt index 68d0c9c0080..a12181abb9f 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/annotations/publicField/publicFieldOnDelegatedProperty.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/annotations/publicField/publicFieldOnDelegatedProperty.kt @@ -1,3 +1,3 @@ class C { - private @publicField val a: String by lazy { "A" } -} \ No newline at end of file + private @publicField val a: String by lazy { "A" } +} diff --git a/compiler/testData/diagnostics/testsWithStdLib/reified/reifiedNothingSubstitution.kt b/compiler/testData/diagnostics/testsWithStdLib/reified/reifiedNothingSubstitution.kt index 089f72a5f03..f409857d53d 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/reified/reifiedNothingSubstitution.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/reified/reifiedNothingSubstitution.kt @@ -1,4 +1,4 @@ -// !DIAGNOSTICS: -UNUSED_PARAMETER -UNREACHABLE_CODE -UNUSED_VARIABLE -DEPRECATED_SYMBOL_WITH_MESSAGE +// !DIAGNOSTICS: -UNUSED_PARAMETER -UNREACHABLE_CODE -UNUSED_VARIABLE -DEPRECATION inline fun foo(block: () -> T): String = block().toString() diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/caches/resolve/JavaResolveExtension.kt b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/caches/resolve/JavaResolveExtension.kt index 266fbe4aa98..2777162c0d7 100644 --- a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/caches/resolve/JavaResolveExtension.kt +++ b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/caches/resolve/JavaResolveExtension.kt @@ -33,7 +33,7 @@ import org.jetbrains.kotlin.resolve.scopes.JetScope private fun PsiElement.getJavaDescriptorResolver(): JavaDescriptorResolver? { if (!ProjectRootsUtil.isInProjectOrLibraryClassFile(this)) return null - @Suppress("DEPRECATED_SYMBOL_WITH_MESSAGE") + @Suppress("DEPRECATION") return KotlinCacheService.getInstance(project).getProjectService(JvmPlatform, this.getModuleInfo(), javaClass()) } diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/highlighter/JetPsiChecker.kt b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/highlighter/JetPsiChecker.kt index 4d0f6d8f266..fe003530865 100644 --- a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/highlighter/JetPsiChecker.kt +++ b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/highlighter/JetPsiChecker.kt @@ -149,9 +149,8 @@ public open class JetPsiChecker : Annotator, HighlightRangeExtension { for (textRange in textRanges) { val annotation = holder.createWarningAnnotation(textRange, getDefaultMessage(diagnostic)) - when (factory) { - Errors.DEPRECATED_SYMBOL, - Errors.DEPRECATED_SYMBOL_WITH_MESSAGE -> annotation.setTextAttributes(CodeInsightColors.DEPRECATED_ATTRIBUTES) + if (factory == Errors.DEPRECATION) { + annotation.textAttributes = CodeInsightColors.DEPRECATED_ATTRIBUTES } setUpAnnotation(diagnostic, annotation, if (factory in Errors.UNUSED_ELEMENT_DIAGNOSTICS) diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/KotlinCleanupInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/KotlinCleanupInspection.kt index f8d34970f13..7dc08117b3d 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/KotlinCleanupInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/KotlinCleanupInspection.kt @@ -88,7 +88,7 @@ public class KotlinCleanupInspection(): LocalInspectionTool(), CleanupLocalInspe Errors.USELESS_CAST, Errors.USELESS_ELVIS, ErrorsJvm.POSITIONED_VALUE_ARGUMENT_FOR_JAVA_ANNOTATION, - Errors.DEPRECATED_SYMBOL_WITH_MESSAGE, + Errors.DEPRECATION, Errors.NON_CONST_VAL_USED_IN_CONSTANT_EXPRESSION, Errors.BACKING_FIELD_OLD_SYNTAX, Errors.OPERATOR_MODIFIER_REQUIRED, diff --git a/idea/src/org/jetbrains/kotlin/idea/quickfix/QuickFixRegistrar.kt b/idea/src/org/jetbrains/kotlin/idea/quickfix/QuickFixRegistrar.kt index c3c3abd67d6..4546271ec90 100644 --- a/idea/src/org/jetbrains/kotlin/idea/quickfix/QuickFixRegistrar.kt +++ b/idea/src/org/jetbrains/kotlin/idea/quickfix/QuickFixRegistrar.kt @@ -312,8 +312,7 @@ public class QuickFixRegistrar : QuickFixContributor { UNRESOLVED_REFERENCE.registerFactory(ReplaceObsoleteLabelSyntaxFix, ReplaceObsoleteLabelSyntaxFix.createWholeProjectFixFactory()) - DEPRECATED_SYMBOL_WITH_MESSAGE.registerFactory(DeprecatedSymbolUsageFix, - DeprecatedSymbolUsageInWholeProjectFix) + DEPRECATION.registerFactory(DeprecatedSymbolUsageFix, DeprecatedSymbolUsageInWholeProjectFix) POSITIONED_VALUE_ARGUMENT_FOR_JAVA_ANNOTATION.registerFactory(ReplaceJavaAnnotationPositionedArgumentsFix) diff --git a/idea/src/org/jetbrains/kotlin/idea/quickfix/replaceWith/DeprecatedSymbolUsageFixBase.kt b/idea/src/org/jetbrains/kotlin/idea/quickfix/replaceWith/DeprecatedSymbolUsageFixBase.kt index 9a78679594f..6af293e3ddd 100644 --- a/idea/src/org/jetbrains/kotlin/idea/quickfix/replaceWith/DeprecatedSymbolUsageFixBase.kt +++ b/idea/src/org/jetbrains/kotlin/idea/quickfix/replaceWith/DeprecatedSymbolUsageFixBase.kt @@ -100,7 +100,7 @@ public abstract class DeprecatedSymbolUsageFixBase( else null) ?: return null - val descriptor = Errors.DEPRECATED_SYMBOL_WITH_MESSAGE.cast(deprecatedDiagnostic).a + val descriptor = Errors.DEPRECATION.cast(deprecatedDiagnostic).a val replacement = DeprecatedSymbolUsageFixBase.fetchReplaceWithPattern(descriptor, nameExpression.project) ?: return null return Data(nameExpression, replacement, descriptor) } diff --git a/idea/testData/highlighter/deprecated/Class.kt b/idea/testData/highlighter/deprecated/Class.kt index 95f0a217fda..4463629e476 100644 --- a/idea/testData/highlighter/deprecated/Class.kt +++ b/idea/testData/highlighter/deprecated/Class.kt @@ -5,16 +5,16 @@ import java.util.ArrayList @Deprecated("Use A instead") open class MyClass {} fun test() { - val a : MyClass? = null - val b = MyClass() - val c = ArrayList<MyClass>() + val a : MyClass? = null + val b = MyClass() + val c = ArrayList<MyClass>() a == b && a == c } -class Test(): MyClass() {} +class Test(): MyClass() {} -class Test2(param: MyClass) {} +class Test2(param: MyClass) {} // NO_CHECK_INFOS // NO_CHECK_WEAK_WARNINGS diff --git a/idea/testData/highlighter/deprecated/ClassObject.kt b/idea/testData/highlighter/deprecated/ClassObject.kt index 86efefe728d..dc745a8ec4e 100644 --- a/idea/testData/highlighter/deprecated/ClassObject.kt +++ b/idea/testData/highlighter/deprecated/ClassObject.kt @@ -1,13 +1,13 @@ fun test() { - MyClass.test + MyClass.test MyClass() val a: MyClass? = null val b: MyTrait? = null - MyTrait.test - MyTrait.Companion - MyTrait - MyClass.Companion - MyClass.Companion.test + MyTrait.test + MyTrait.Companion + MyTrait + MyClass.Companion + MyClass.Companion.test a == b } @@ -25,4 +25,4 @@ interface MyTrait { } // NO_CHECK_INFOS -// NO_CHECK_WEAK_WARNINGS \ No newline at end of file +// NO_CHECK_WEAK_WARNINGS diff --git a/idea/testData/highlighter/deprecated/Function.kt b/idea/testData/highlighter/deprecated/Function.kt index 5048d727558..95ae3e4a158 100644 --- a/idea/testData/highlighter/deprecated/Function.kt +++ b/idea/testData/highlighter/deprecated/Function.kt @@ -1,9 +1,9 @@ fun test() { - test1() - MyClass().test2() - MyClass.test3() + test1() + MyClass().test2() + MyClass.test3() - test4(1, 2) + test4(1, 2) } @Deprecated("Use A instead") fun test1() { } @@ -18,4 +18,4 @@ class MyClass() { } // NO_CHECK_INFOS -// NO_CHECK_WEAK_WARNINGS \ No newline at end of file +// NO_CHECK_WEAK_WARNINGS diff --git a/idea/testData/highlighter/deprecated/Get.kt b/idea/testData/highlighter/deprecated/Get.kt index 0a4c6ab9c3a..5f23a34c634 100644 --- a/idea/testData/highlighter/deprecated/Get.kt +++ b/idea/testData/highlighter/deprecated/Get.kt @@ -6,8 +6,8 @@ fun test() { val x1 = MyClass() val x2 = MyClass() - x1[x2] + x1[x2] } // NO_CHECK_INFOS -// NO_CHECK_WEAK_WARNINGS \ No newline at end of file +// NO_CHECK_WEAK_WARNINGS diff --git a/idea/testData/highlighter/deprecated/Getter.kt b/idea/testData/highlighter/deprecated/Getter.kt index 574604ca3be..43296d71aed 100644 --- a/idea/testData/highlighter/deprecated/Getter.kt +++ b/idea/testData/highlighter/deprecated/Getter.kt @@ -1,10 +1,10 @@ fun test() { val c = MyClass() - c.test1 - c.test2 + c.test1 + c.test2 c.test2 = "" - c.test3 + c.test3 } class MyClass() { @@ -19,4 +19,4 @@ class MyClass() { } // NO_CHECK_INFOS -// NO_CHECK_WEAK_WARNINGS \ No newline at end of file +// NO_CHECK_WEAK_WARNINGS diff --git a/idea/testData/highlighter/deprecated/Inc.kt b/idea/testData/highlighter/deprecated/Inc.kt index 2bfdc67aba8..668f83ab398 100644 --- a/idea/testData/highlighter/deprecated/Inc.kt +++ b/idea/testData/highlighter/deprecated/Inc.kt @@ -6,9 +6,9 @@ class MyClass { fun test() { var x3 = MyClass() - x3++ + x3++ x3.i } // NO_CHECK_INFOS -// NO_CHECK_WEAK_WARNINGS \ No newline at end of file +// NO_CHECK_WEAK_WARNINGS diff --git a/idea/testData/highlighter/deprecated/Invalid.kt b/idea/testData/highlighter/deprecated/Invalid.kt index 6b6d16de6f6..b1d714035c2 100644 --- a/idea/testData/highlighter/deprecated/Invalid.kt +++ b/idea/testData/highlighter/deprecated/Invalid.kt @@ -3,9 +3,9 @@ fun foo() {} @Deprecated(false) fun boo() {} -fun far() = foo() +fun far() = foo() -fun bar() = boo() +fun bar() = boo() // NO_CHECK_INFOS // NO_CHECK_WEAK_WARNINGS diff --git a/idea/testData/highlighter/deprecated/Invoke.kt b/idea/testData/highlighter/deprecated/Invoke.kt index 3b51ab494db..3ba3a74f493 100644 --- a/idea/testData/highlighter/deprecated/Invoke.kt +++ b/idea/testData/highlighter/deprecated/Invoke.kt @@ -5,8 +5,8 @@ class MyRunnable() {} fun test() { val m = MyRunnable() - m() + m() } // NO_CHECK_INFOS -// NO_CHECK_WEAK_WARNINGS \ No newline at end of file +// NO_CHECK_WEAK_WARNINGS diff --git a/idea/testData/highlighter/deprecated/Operation.kt b/idea/testData/highlighter/deprecated/Operation.kt index b1ed6a6a215..cf2dd29971c 100644 --- a/idea/testData/highlighter/deprecated/Operation.kt +++ b/idea/testData/highlighter/deprecated/Operation.kt @@ -19,20 +19,20 @@ fun test() { val x1 = MyClass() val x2 = MyClass() - x1 - x2 - x1 / x2 - x1 * x2 + x1 - x2 + x1 / x2 + x1 * x2 - !x1 - +x1 + !x1 + +x1 - x1 in x2 - x1 !in x2 + x1 in x2 + x1 !in x2 - x1 += x2 + x1 += x2 - x1..x2 + x1..x2 } // NO_CHECK_INFOS -// NO_CHECK_WEAK_WARNINGS \ No newline at end of file +// NO_CHECK_WEAK_WARNINGS diff --git a/idea/testData/highlighter/deprecated/Property.kt b/idea/testData/highlighter/deprecated/Property.kt index 144887263ea..d51467599be 100644 --- a/idea/testData/highlighter/deprecated/Property.kt +++ b/idea/testData/highlighter/deprecated/Property.kt @@ -1,11 +1,11 @@ fun test() { - test1 == "" - MyClass().test2 - MyClass.test3 + test1 == "" + MyClass().test2 + MyClass.test3 - test4 == "" - MyClass().test5 - MyClass.test6 + test4 == "" + MyClass().test5 + MyClass.test6 } @Deprecated("Use A instead") val test1: String = "" @@ -22,4 +22,4 @@ class MyClass() { } // NO_CHECK_INFOS -// NO_CHECK_WEAK_WARNINGS \ No newline at end of file +// NO_CHECK_WEAK_WARNINGS diff --git a/idea/testData/highlighter/deprecated/RangeTo.kt b/idea/testData/highlighter/deprecated/RangeTo.kt index e9a5544e1d0..500917c9e41 100644 --- a/idea/testData/highlighter/deprecated/RangeTo.kt +++ b/idea/testData/highlighter/deprecated/RangeTo.kt @@ -11,7 +11,7 @@ fun test() { val x1 = MyClass() val x2 = MyClass() - for (i in x1..x2) { + for (i in x1..x2) { } } diff --git a/idea/testData/highlighter/deprecated/Setter.kt b/idea/testData/highlighter/deprecated/Setter.kt index 75f78cb3286..8050d22314d 100644 --- a/idea/testData/highlighter/deprecated/Setter.kt +++ b/idea/testData/highlighter/deprecated/Setter.kt @@ -1,20 +1,20 @@ fun test() { MyClass().test1 - MyClass().test1 = 0 + MyClass().test1 = 0 - MyClass().test1++ - MyClass().test1-- + MyClass().test1++ + MyClass().test1-- - ++MyClass().test1 - --MyClass().test1 + ++MyClass().test1 + --MyClass().test1 - MyClass().test1 += 1 - MyClass().test1 -= 1 - MyClass().test1 /= 1 - MyClass().test1 *= 1 + MyClass().test1 += 1 + MyClass().test1 -= 1 + MyClass().test1 /= 1 + MyClass().test1 *= 1 test2 + 1 - test2 = 10 + test2 = 10 } class MyClass() { @@ -26,4 +26,4 @@ public var test2: Int = 0 @Deprecated("Use A instead") set // NO_CHECK_INFOS -// NO_CHECK_WEAK_WARNINGS \ No newline at end of file +// NO_CHECK_WEAK_WARNINGS diff --git a/idea/testData/highlighter/deprecated/Trait.kt b/idea/testData/highlighter/deprecated/Trait.kt index e22d769027b..30175ebf3f9 100644 --- a/idea/testData/highlighter/deprecated/Trait.kt +++ b/idea/testData/highlighter/deprecated/Trait.kt @@ -1,14 +1,14 @@ @Deprecated("Use A instead") interface MyTrait { } fun test() { - val a: MyTrait? = null - val b: List<MyTrait>? = null + val a: MyTrait? = null + val b: List<MyTrait>? = null a == b } -class Test(): MyTrait { } +class Test(): MyTrait { } -class Test2(param: MyTrait) {} +class Test2(param: MyTrait) {} // NO_CHECK_INFOS -// NO_CHECK_WEAK_WARNINGS \ No newline at end of file +// NO_CHECK_WEAK_WARNINGS