Merge two deprecation diagnostics into one DEPRECATION

This also fixes weird suppressions in user code: instead of
«@Suppress("DEPRECATED_SYMBOL_WITH_MESSAGE")» you should now use
«@Suppress("DEPRECATION")»
This commit is contained in:
Alexander Udalov
2015-10-07 22:10:59 +03:00
committed by Andrey Breslav
parent c817949221
commit 34267e436e
39 changed files with 162 additions and 169 deletions
@@ -240,8 +240,7 @@ public interface Errors {
DiagnosticFactory0<JetObjectDeclaration> MANY_COMPANION_OBJECTS = DiagnosticFactory0.create(ERROR, COMPANION_OBJECT);
DiagnosticFactory1<PsiElement, DeclarationDescriptor> DEPRECATED_SYMBOL = DiagnosticFactory1.create(WARNING);
DiagnosticFactory2<PsiElement, DeclarationDescriptor, String> DEPRECATED_SYMBOL_WITH_MESSAGE = DiagnosticFactory2.create(WARNING);
DiagnosticFactory2<PsiElement, DeclarationDescriptor, String> DEPRECATION = DiagnosticFactory2.create(WARNING);
// Objects
@@ -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);
@@ -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,
+2 -2
View File
@@ -1,4 +1,4 @@
// !DIAGNOSTICS: -DEPRECATED_SYMBOL_WITH_MESSAGE
// !DIAGNOSTICS: -DEPRECATION
<!UNDERSCORE_IS_DEPRECATED!>import kotlin.Deprecated as ___<!>
@@ -13,4 +13,4 @@ fun <!UNDERSCORE_IS_DEPRECATED!>__<!>(<!UNDERSCORE_IS_DEPRECATED!>___<!>: Int, y
// in backquotes: allowed
val `_` = __________
<!UNDERSCORE_IS_DEPRECATED!>__<!>@ return if (y != null) __(____, y) else __(`_`, ______)
}
}
@@ -4,6 +4,6 @@ annotation class obsolete()
@Deprecated("text")
annotation class obsoleteWithParam(val text: String)
@<!DEPRECATED_SYMBOL_WITH_MESSAGE!>obsolete<!> class Obsolete
@<!DEPRECATION!>obsolete<!> class Obsolete
@<!DEPRECATED_SYMBOL_WITH_MESSAGE!>obsoleteWithParam<!>("text") class Obsolete2
@<!DEPRECATION!>obsoleteWithParam<!>("text") class Obsolete2
@@ -7,5 +7,5 @@ class Data {
}
fun use() {
val (<!DEPRECATED_SYMBOL_WITH_MESSAGE!>x<!>, y) = Data()
}
val (<!DEPRECATION!>x<!>, y) = Data()
}
@@ -22,28 +22,28 @@ object InvocableHolder {
fun invoker() {
val invocable = Invocable()
<!DEPRECATED_SYMBOL_WITH_MESSAGE!>invocable<!>()
InvocableHolder.<!DEPRECATED_SYMBOL_WITH_MESSAGE!>invocable<!>()
<!DEPRECATION!>invocable<!>()
InvocableHolder.<!DEPRECATION!>invocable<!>()
}
fun block() {
<!DEPRECATED_SYMBOL_WITH_MESSAGE!>Obsolete<!>()
<!DEPRECATED_SYMBOL_WITH_MESSAGE!>Obsolete<!>(2)
<!DEPRECATION!>Obsolete<!>()
<!DEPRECATION!>Obsolete<!>(2)
}
fun expression() = <!DEPRECATED_SYMBOL_WITH_MESSAGE!>Obsolete<!>()
fun expression() = <!DEPRECATION!>Obsolete<!>()
fun reflection() = ::<!DEPRECATED_SYMBOL_WITH_MESSAGE!>Obsolete<!>
fun reflection2() = UsefulClass::<!DEPRECATED_SYMBOL_WITH_MESSAGE!>member<!>
fun reflection() = ::<!DEPRECATION!>Obsolete<!>
fun reflection2() = UsefulClass::<!DEPRECATION!>member<!>
class Initializer {
val x = <!DEPRECATED_SYMBOL_WITH_MESSAGE!>Obsolete<!>()
val x = <!DEPRECATION!>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 <!DEPRECATED_SYMBOL_WITH_MESSAGE!>Obsolete<!>()
var y by <!DEPRECATED_SYMBOL_WITH_MESSAGE!>Obsolete<!>()
}
val x by <!DEPRECATION!>Obsolete<!>()
var y by <!DEPRECATION!>Obsolete<!>()
}
@@ -5,4 +5,4 @@ open class C<T>() {
constructor(p: Int) : this(){}
}
class D : <!DEPRECATED_SYMBOL_WITH_MESSAGE!>C<String><!>(1)
class D : <!DEPRECATION!>C<String><!>(1)
+2 -2
View File
@@ -1,8 +1,8 @@
import <!DEPRECATED_SYMBOL_WITH_MESSAGE!>C<!> as C2
import <!DEPRECATION!>C<!> as C2
@Deprecated("obsolete")
class C {
fun use() {}
}
fun useAlias(c : <!DEPRECATED_SYMBOL_WITH_MESSAGE!>C2<!>) { c.use() }
fun useAlias(c : <!DEPRECATION!>C2<!>) { c.use() }
@@ -19,6 +19,6 @@ class Iter2 {
}
fun use() {
for (x in <!DEPRECATED_SYMBOL_WITH_MESSAGE!>Iter()<!>) {}
for (x in <!DEPRECATED_SYMBOL_WITH_MESSAGE, DEPRECATED_SYMBOL_WITH_MESSAGE!>Iter2()<!>) {}
}
for (x in <!DEPRECATION!>Iter()<!>) {}
for (x in <!DEPRECATION, DEPRECATION!>Iter2()<!>) {}
}
@@ -11,6 +11,6 @@ public class A {
// FILE: B.kt
class B(private @property:Deprecated val foo: String) : <!DEPRECATED_SYMBOL_WITH_MESSAGE!>A<!>() {
override fun getFoo(text: String): String = super.<!DEPRECATED_SYMBOL_WITH_MESSAGE!>getFoo<!>(text + <!DEPRECATED_SYMBOL!>foo<!>)
}
class B(private @property:Deprecated val foo: String) : <!DEPRECATION!>A<!>() {
override fun getFoo(text: String): String = super.<!DEPRECATION!>getFoo<!>(text + <!DEPRECATION!>foo<!>)
}
@@ -15,6 +15,6 @@ public class A {
// FILE: B.kt
class B(private val foo: String) : <!DEPRECATED_SYMBOL_WITH_MESSAGE!>A<!>() {
override fun getFoo(text: String): String = super.<!DEPRECATED_SYMBOL_WITH_MESSAGE!>getFoo<!>(text + foo)
class B(private val foo: String) : <!DEPRECATION!>A<!>() {
override fun getFoo(text: String): String = super.<!DEPRECATION!>getFoo<!>(text + foo)
}
@@ -12,7 +12,7 @@ class TopLevel {
}
fun useNested() {
val <!UNUSED_VARIABLE!>d<!> = TopLevel.<!DEPRECATED_SYMBOL_WITH_MESSAGE!>Nested<!>.use()
TopLevel.<!DEPRECATED_SYMBOL_WITH_MESSAGE!>Nested<!>.Nested2()
TopLevel.<!DEPRECATED_SYMBOL_WITH_MESSAGE!>Nested<!>.<!UNRESOLVED_REFERENCE!>CompanionNested2<!>()
}
val <!UNUSED_VARIABLE!>d<!> = TopLevel.<!DEPRECATION!>Nested<!>.use()
TopLevel.<!DEPRECATION!>Nested<!>.Nested2()
TopLevel.<!DEPRECATION!>Nested<!>.<!UNRESOLVED_REFERENCE!>CompanionNested2<!>()
}
@@ -11,17 +11,17 @@ class Another {
}
fun first() {
<!DEPRECATED_SYMBOL_WITH_MESSAGE!>Another<!>.use()
<!DEPRECATION!>Another<!>.use()
}
fun useObject() {
<!DEPRECATED_SYMBOL_WITH_MESSAGE!>Obsolete<!>.use()
val <!UNUSED_VARIABLE!>x<!> = <!DEPRECATED_SYMBOL_WITH_MESSAGE!>Obsolete<!>
<!DEPRECATION!>Obsolete<!>.use()
val <!UNUSED_VARIABLE!>x<!> = <!DEPRECATION!>Obsolete<!>
}
fun useCompanion() {
val <!UNUSED_VARIABLE!>d<!> = <!DEPRECATED_SYMBOL_WITH_MESSAGE!>Another<!>
val <!UNUSED_VARIABLE!>x<!> = Another.<!DEPRECATED_SYMBOL_WITH_MESSAGE!>Companion<!>
Another.<!DEPRECATED_SYMBOL_WITH_MESSAGE!>Companion<!>.use()
<!DEPRECATED_SYMBOL_WITH_MESSAGE!>Another<!>.use()
}
val <!UNUSED_VARIABLE!>d<!> = <!DEPRECATION!>Another<!>
val <!UNUSED_VARIABLE!>x<!> = Another.<!DEPRECATION!>Companion<!>
Another.<!DEPRECATION!>Companion<!>.use()
<!DEPRECATION!>Another<!>.use()
}
@@ -15,8 +15,8 @@ class PropertyHolder {
@Deprecated("text")
var name = "String"
val valDelegate <!DEPRECATED_SYMBOL_WITH_MESSAGE!>by<!> Delegate()
var varDelegate <!DEPRECATED_SYMBOL_WITH_MESSAGE, DEPRECATED_SYMBOL_WITH_MESSAGE!>by<!> Delegate()
val valDelegate <!DEPRECATION!>by<!> Delegate()
var varDelegate <!DEPRECATION, DEPRECATION!>by<!> Delegate()
public val test1: String = ""
@Deprecated("val-getter") get
@@ -35,24 +35,24 @@ class PropertyHolder {
}
fun PropertyHolder.extFunction() {
<!DEPRECATED_SYMBOL_WITH_MESSAGE!>test2<!> = "ext"
<!DEPRECATED_SYMBOL_WITH_MESSAGE!>test1<!>
<!DEPRECATION!>test2<!> = "ext"
<!DEPRECATION!>test1<!>
}
fun fn() {
PropertyHolder().<!DEPRECATED_SYMBOL_WITH_MESSAGE!>test1<!>
PropertyHolder().<!DEPRECATED_SYMBOL_WITH_MESSAGE!>test2<!>
PropertyHolder().<!DEPRECATED_SYMBOL_WITH_MESSAGE!>test2<!> = ""
PropertyHolder().<!DEPRECATION!>test1<!>
PropertyHolder().<!DEPRECATION!>test2<!>
PropertyHolder().<!DEPRECATION!>test2<!> = ""
PropertyHolder().<!DEPRECATED_SYMBOL_WITH_MESSAGE!>test3<!>
PropertyHolder().<!DEPRECATION!>test3<!>
PropertyHolder().test3 = ""
PropertyHolder().test4
PropertyHolder().<!DEPRECATED_SYMBOL_WITH_MESSAGE!>test4<!> = ""
PropertyHolder().<!DEPRECATION!>test4<!> = ""
val <!UNUSED_VARIABLE!>a<!> = PropertyHolder().<!DEPRECATED_SYMBOL_WITH_MESSAGE!>x<!>
val <!UNUSED_VARIABLE!>b<!> = PropertyHolder().<!DEPRECATED_SYMBOL_WITH_MESSAGE!>name<!>
PropertyHolder().<!DEPRECATED_SYMBOL_WITH_MESSAGE!>name<!> = "value"
val <!UNUSED_VARIABLE!>a<!> = PropertyHolder().<!DEPRECATION!>x<!>
val <!UNUSED_VARIABLE!>b<!> = PropertyHolder().<!DEPRECATION!>name<!>
PropertyHolder().<!DEPRECATION!>name<!> = "value"
val <!UNUSED_VARIABLE!>d<!> = PropertyHolder().valDelegate
PropertyHolder().varDelegate = 1
@@ -60,5 +60,5 @@ fun fn() {
fun literals() {
PropertyHolder::test1
PropertyHolder::<!DEPRECATED_SYMBOL_WITH_MESSAGE!>name<!>
}
PropertyHolder::<!DEPRECATION!>name<!>
}
@@ -17,15 +17,15 @@ class PropertyHolder {
fun fn() {
val holder = PropertyHolder()
holder.<!DEPRECATED_SYMBOL_WITH_MESSAGE!>a1<!>
holder.<!DEPRECATED_SYMBOL_WITH_MESSAGE!>a2<!>
holder.<!DEPRECATED_SYMBOL_WITH_MESSAGE!>withGetter<!>
holder.<!DEPRECATED_SYMBOL_WITH_MESSAGE!>withSetter<!> = "A"
holder.<!DEPRECATION!>a1<!>
holder.<!DEPRECATION!>a2<!>
holder.<!DEPRECATION!>withGetter<!>
holder.<!DEPRECATION!>withSetter<!> = "A"
}
fun literals() {
PropertyHolder::<!DEPRECATED_SYMBOL_WITH_MESSAGE!>a1<!>
PropertyHolder::<!DEPRECATED_SYMBOL_WITH_MESSAGE!>a2<!>
PropertyHolder::<!DEPRECATION!>a1<!>
PropertyHolder::<!DEPRECATION!>a2<!>
PropertyHolder::withGetter
PropertyHolder::withSetter
}
}
+15 -15
View File
@@ -10,33 +10,33 @@ open class Obsolete2 @Deprecated("Constructor") constructor() {
interface Generic<T>
open class Derived() : <!DEPRECATED_SYMBOL_WITH_MESSAGE!>Obsolete<!>()
open class Derived() : <!DEPRECATION!>Obsolete<!>()
class Derived2() : Derived()
class TypeParam : Generic<<!DEPRECATED_SYMBOL_WITH_MESSAGE!>Obsolete<!>>
class TypeParam : Generic<<!DEPRECATION!>Obsolete<!>>
object Object : <!DEPRECATED_SYMBOL_WITH_MESSAGE!>Obsolete<!>()
object Object : <!DEPRECATION!>Obsolete<!>()
class Properties {
val x : <!DEPRECATED_SYMBOL_WITH_MESSAGE!>Obsolete<!> = <!DEPRECATED_SYMBOL_WITH_MESSAGE!>Obsolete<!>()
var y : <!DEPRECATED_SYMBOL_WITH_MESSAGE!>Obsolete<!> = <!DEPRECATED_SYMBOL_WITH_MESSAGE!>Obsolete<!>()
val x : <!DEPRECATION!>Obsolete<!> = <!DEPRECATION!>Obsolete<!>()
var y : <!DEPRECATION!>Obsolete<!> = <!DEPRECATION!>Obsolete<!>()
var n : <!DEPRECATED_SYMBOL_WITH_MESSAGE!>Obsolete<!>
get() = <!DEPRECATED_SYMBOL_WITH_MESSAGE!>Obsolete<!>()
var n : <!DEPRECATION!>Obsolete<!>
get() = <!DEPRECATION!>Obsolete<!>()
set(value) {}
}
fun param(param: <!DEPRECATED_SYMBOL_WITH_MESSAGE!>Obsolete<!>) { param.use() }
fun param(param: <!DEPRECATION!>Obsolete<!>) { param.use() }
fun funcParamReceiver(param: <!DEPRECATED_SYMBOL_WITH_MESSAGE!>Obsolete<!>.()->Unit) { <!DEPRECATED_SYMBOL_WITH_MESSAGE!>Obsolete<!>().param() }
fun funcParamParam(param: (<!DEPRECATED_SYMBOL_WITH_MESSAGE!>Obsolete<!>)->Unit) { param(<!DEPRECATED_SYMBOL_WITH_MESSAGE!>Obsolete<!>()) }
fun funcParamRetVal(param: ()-><!DEPRECATED_SYMBOL_WITH_MESSAGE!>Obsolete<!>) { param() }
fun funcParamReceiver(param: <!DEPRECATION!>Obsolete<!>.()->Unit) { <!DEPRECATION!>Obsolete<!>().param() }
fun funcParamParam(param: (<!DEPRECATION!>Obsolete<!>)->Unit) { param(<!DEPRECATION!>Obsolete<!>()) }
fun funcParamRetVal(param: ()-><!DEPRECATION!>Obsolete<!>) { param() }
fun <T: <!DEPRECATED_SYMBOL_WITH_MESSAGE!>Obsolete<!>> constraint() {}
fun <T: <!DEPRECATION!>Obsolete<!>> constraint() {}
fun <!DEPRECATED_SYMBOL_WITH_MESSAGE!>Obsolete<!>.receiver() {}
fun <!DEPRECATION!>Obsolete<!>.receiver() {}
fun retVal(): <!DEPRECATED_SYMBOL_WITH_MESSAGE!>Obsolete<!> = <!DEPRECATED_SYMBOL_WITH_MESSAGE!>Obsolete<!>()
fun retVal(): <!DEPRECATION!>Obsolete<!> = <!DEPRECATION!>Obsolete<!>()
fun nullableRetVal(): <!DEPRECATED_SYMBOL_WITH_MESSAGE!>Obsolete<!>? = null
fun nullableRetVal(): <!DEPRECATION!>Obsolete<!>? = null
@@ -1,6 +1,6 @@
// No supertype at all
class A1 {
fun test() {
<!SUPER_CANT_BE_EXTENSION_RECEIVER!>super<!>.<!DEPRECATED_SYMBOL_WITH_MESSAGE!>identityEquals<!>(null) // Call to an extension function
<!SUPER_CANT_BE_EXTENSION_RECEIVER!>super<!>.<!DEPRECATION!>identityEquals<!>(null) // Call to an extension function
}
}
}
@@ -1,16 +1,16 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
class C {
<!WRONG_ANNOTATION_TARGET!>@<!DEPRECATED_SYMBOL_WITH_MESSAGE!>kotlin.jvm.publicField<!><!> constructor(s: String) {
<!WRONG_ANNOTATION_TARGET!>@<!DEPRECATION!>kotlin.jvm.publicField<!><!> constructor(s: String) {
}
<!WRONG_ANNOTATION_TARGET!>@<!DEPRECATED_SYMBOL_WITH_MESSAGE!>kotlin.jvm.publicField<!><!> private fun foo(s: String = "OK") {
<!WRONG_ANNOTATION_TARGET!>@<!DEPRECATION!>kotlin.jvm.publicField<!><!> private fun foo(s: String = "OK") {
}
}
<!WRONG_ANNOTATION_TARGET!>@<!DEPRECATED_SYMBOL_WITH_MESSAGE!>kotlin.jvm.publicField<!><!>
<!WRONG_ANNOTATION_TARGET!>@<!DEPRECATION!>kotlin.jvm.publicField<!><!>
fun foo() {
<!WRONG_ANNOTATION_TARGET!>@<!DEPRECATED_SYMBOL_WITH_MESSAGE!>kotlin.jvm.publicField<!><!> val <!UNUSED_VARIABLE!>x<!> = "A"
}
<!WRONG_ANNOTATION_TARGET!>@<!DEPRECATION!>kotlin.jvm.publicField<!><!> val <!UNUSED_VARIABLE!>x<!> = "A"
}
@@ -1,3 +1,3 @@
class C {
private <!INAPPLICABLE_PUBLIC_FIELD!>@<!DEPRECATED_SYMBOL_WITH_MESSAGE!>publicField<!><!> val a: String by lazy { "A" }
}
private <!INAPPLICABLE_PUBLIC_FIELD!>@<!DEPRECATION!>publicField<!><!> val a: String by lazy { "A" }
}
@@ -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<reified T> foo(block: () -> T): String = block().toString()
@@ -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<JavaDescriptorResolver>())
}
@@ -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)
@@ -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,
@@ -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)
@@ -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)
}
+5 -5
View File
@@ -5,16 +5,16 @@ import java.util.ArrayList
@Deprecated("Use A instead") open class MyClass {}
fun test() {
val a : <warning descr="[DEPRECATED_SYMBOL_WITH_MESSAGE] 'MyClass' is deprecated. Use A instead">MyClass</warning>? = null
val b = <warning descr="[DEPRECATED_SYMBOL_WITH_MESSAGE] 'MyClass' is deprecated. Use A instead">MyClass</warning>()
val c = ArrayList<<warning descr="[DEPRECATED_SYMBOL_WITH_MESSAGE] 'MyClass' is deprecated. Use A instead">MyClass</warning>>()
val a : <warning descr="[DEPRECATION] 'MyClass' is deprecated. Use A instead">MyClass</warning>? = null
val b = <warning descr="[DEPRECATION] 'MyClass' is deprecated. Use A instead">MyClass</warning>()
val c = ArrayList<<warning descr="[DEPRECATION] 'MyClass' is deprecated. Use A instead">MyClass</warning>>()
a == b && a == c
}
class Test(): <warning descr="[DEPRECATED_SYMBOL_WITH_MESSAGE] 'MyClass' is deprecated. Use A instead">MyClass</warning>() {}
class Test(): <warning descr="[DEPRECATION] 'MyClass' is deprecated. Use A instead">MyClass</warning>() {}
class Test2(<warning descr="[UNUSED_PARAMETER] Parameter 'param' is never used">param</warning>: <warning descr="[DEPRECATED_SYMBOL_WITH_MESSAGE] 'MyClass' is deprecated. Use A instead">MyClass</warning>) {}
class Test2(<warning descr="[UNUSED_PARAMETER] Parameter 'param' is never used">param</warning>: <warning descr="[DEPRECATION] 'MyClass' is deprecated. Use A instead">MyClass</warning>) {}
// NO_CHECK_INFOS
// NO_CHECK_WEAK_WARNINGS
+7 -7
View File
@@ -1,13 +1,13 @@
fun test() {
<warning descr="[DEPRECATED_SYMBOL_WITH_MESSAGE] 'companion object of MyClass' is deprecated. Use A instead">MyClass</warning>.<warning descr="[DEPRECATED_SYMBOL_WITH_MESSAGE] 'companion object of MyClass' is deprecated. Use A instead">test</warning>
<warning descr="[DEPRECATION] 'companion object of MyClass' is deprecated. Use A instead">MyClass</warning>.<warning descr="[DEPRECATION] 'companion object of MyClass' is deprecated. Use A instead">test</warning>
MyClass()
val a: MyClass? = null
val b: MyTrait? = null
<warning descr="[DEPRECATED_SYMBOL_WITH_MESSAGE] 'companion object of MyTrait' is deprecated. Use A instead">MyTrait</warning>.<warning descr="[DEPRECATED_SYMBOL_WITH_MESSAGE] 'companion object of MyTrait' is deprecated. Use A instead">test</warning>
MyTrait.<warning descr="[DEPRECATED_SYMBOL_WITH_MESSAGE] 'companion object of MyTrait' is deprecated. Use A instead">Companion</warning>
<warning descr="[DEPRECATED_SYMBOL_WITH_MESSAGE] 'companion object of MyTrait' is deprecated. Use A instead">MyTrait</warning>
MyClass.<warning descr="[DEPRECATED_SYMBOL_WITH_MESSAGE] 'companion object of MyClass' is deprecated. Use A instead">Companion</warning>
MyClass.<warning descr="[DEPRECATED_SYMBOL_WITH_MESSAGE] 'companion object of MyClass' is deprecated. Use A instead">Companion</warning>.<warning descr="[DEPRECATED_SYMBOL_WITH_MESSAGE] 'companion object of MyClass' is deprecated. Use A instead">test</warning>
<warning descr="[DEPRECATION] 'companion object of MyTrait' is deprecated. Use A instead">MyTrait</warning>.<warning descr="[DEPRECATION] 'companion object of MyTrait' is deprecated. Use A instead">test</warning>
MyTrait.<warning descr="[DEPRECATION] 'companion object of MyTrait' is deprecated. Use A instead">Companion</warning>
<warning descr="[DEPRECATION] 'companion object of MyTrait' is deprecated. Use A instead">MyTrait</warning>
MyClass.<warning descr="[DEPRECATION] 'companion object of MyClass' is deprecated. Use A instead">Companion</warning>
MyClass.<warning descr="[DEPRECATION] 'companion object of MyClass' is deprecated. Use A instead">Companion</warning>.<warning descr="[DEPRECATION] 'companion object of MyClass' is deprecated. Use A instead">test</warning>
a == b
}
@@ -25,4 +25,4 @@ interface MyTrait {
}
// NO_CHECK_INFOS
// NO_CHECK_WEAK_WARNINGS
// NO_CHECK_WEAK_WARNINGS
+5 -5
View File
@@ -1,9 +1,9 @@
fun test() {
<warning descr="[DEPRECATED_SYMBOL_WITH_MESSAGE] 'test1(): Unit' is deprecated. Use A instead">test1</warning>()
MyClass().<warning descr="[DEPRECATED_SYMBOL_WITH_MESSAGE] 'test2(): Unit' is deprecated. Use A instead">test2</warning>()
MyClass.<warning descr="[DEPRECATED_SYMBOL_WITH_MESSAGE] 'test3(): Unit' is deprecated. Use A instead">test3</warning>()
<warning descr="[DEPRECATION] 'test1(): Unit' is deprecated. Use A instead">test1</warning>()
MyClass().<warning descr="[DEPRECATION] 'test2(): Unit' is deprecated. Use A instead">test2</warning>()
MyClass.<warning descr="[DEPRECATION] 'test3(): Unit' is deprecated. Use A instead">test3</warning>()
<warning descr="[DEPRECATED_SYMBOL_WITH_MESSAGE] 'test4(Int, Int): Unit' is deprecated. Use A instead">test4</warning>(1, 2)
<warning descr="[DEPRECATION] 'test4(Int, Int): Unit' is deprecated. Use A instead">test4</warning>(1, 2)
}
@Deprecated("Use A instead") fun test1() { }
@@ -18,4 +18,4 @@ class MyClass() {
}
// NO_CHECK_INFOS
// NO_CHECK_WEAK_WARNINGS
// NO_CHECK_WEAK_WARNINGS
+2 -2
View File
@@ -6,8 +6,8 @@ fun test() {
val x1 = MyClass()
val x2 = MyClass()
<warning descr="[DEPRECATED_SYMBOL_WITH_MESSAGE] 'get(MyClass): MyClass' is deprecated. Use A instead">x1[x2]</warning>
<warning descr="[DEPRECATION] 'get(MyClass): MyClass' is deprecated. Use A instead">x1[x2]</warning>
}
// NO_CHECK_INFOS
// NO_CHECK_WEAK_WARNINGS
// NO_CHECK_WEAK_WARNINGS
+4 -4
View File
@@ -1,10 +1,10 @@
fun test() {
val c = MyClass()
c.<warning descr="[DEPRECATED_SYMBOL_WITH_MESSAGE] 'getter for test1: String' is deprecated. Use A instead">test1</warning>
c.<warning descr="[DEPRECATED_SYMBOL_WITH_MESSAGE] 'getter for test2: String' is deprecated. Use A instead">test2</warning>
c.<warning descr="[DEPRECATION] 'getter for test1: String' is deprecated. Use A instead">test1</warning>
c.<warning descr="[DEPRECATION] 'getter for test2: String' is deprecated. Use A instead">test2</warning>
c.test2 = ""
c.<warning descr="[DEPRECATED_SYMBOL_WITH_MESSAGE] 'test3: String' is deprecated. Use A instead">test3</warning>
c.<warning descr="[DEPRECATION] 'test3: String' is deprecated. Use A instead">test3</warning>
}
class MyClass() {
@@ -19,4 +19,4 @@ class MyClass() {
}
// NO_CHECK_INFOS
// NO_CHECK_WEAK_WARNINGS
// NO_CHECK_WEAK_WARNINGS
+2 -2
View File
@@ -6,9 +6,9 @@ class MyClass {
fun test() {
var x3 = MyClass()
x3<warning descr="[DEPRECATED_SYMBOL_WITH_MESSAGE] 'inc(): MyClass' is deprecated. Use A instead">++</warning>
x3<warning descr="[DEPRECATION] 'inc(): MyClass' is deprecated. Use A instead">++</warning>
x3.i
}
// NO_CHECK_INFOS
// NO_CHECK_WEAK_WARNINGS
// NO_CHECK_WEAK_WARNINGS
+2 -2
View File
@@ -3,9 +3,9 @@ fun foo() {}
@Deprecated(<error>false</error>)
fun boo() {}
fun far() = <warning descr="[DEPRECATED_SYMBOL] 'foo(): Unit' is deprecated.">foo</warning>()
fun far() = <warning descr="[DEPRECATION] 'foo(): Unit' is deprecated. ">foo</warning>()
fun bar() = <warning descr="[DEPRECATED_SYMBOL] 'boo(): Unit' is deprecated.">boo</warning>()
fun bar() = <warning descr="[DEPRECATION] 'boo(): Unit' is deprecated. ">boo</warning>()
// NO_CHECK_INFOS
// NO_CHECK_WEAK_WARNINGS
+2 -2
View File
@@ -5,8 +5,8 @@ class MyRunnable() {}
fun test() {
val m = MyRunnable()
<warning descr="[DEPRECATED_SYMBOL_WITH_MESSAGE] 'invoke(): Unit' is deprecated. Use A instead">m</warning>()
<warning descr="[DEPRECATION] 'invoke(): Unit' is deprecated. Use A instead">m</warning>()
}
// NO_CHECK_INFOS
// NO_CHECK_WEAK_WARNINGS
// NO_CHECK_WEAK_WARNINGS
+10 -10
View File
@@ -19,20 +19,20 @@ fun test() {
val x1 = MyClass()
val x2 = MyClass()
x1 <warning descr="[DEPRECATED_SYMBOL_WITH_MESSAGE] 'minus(MyClass): Unit' is deprecated. Use A instead">-</warning> x2
x1 <warning descr="[DEPRECATED_SYMBOL_WITH_MESSAGE] 'div(MyClass): Unit' is deprecated. Use A instead">/</warning> x2
x1 <warning descr="[DEPRECATED_SYMBOL_WITH_MESSAGE] 'times(MyClass): Unit' is deprecated. Use A instead">*</warning> x2
x1 <warning descr="[DEPRECATION] 'minus(MyClass): Unit' is deprecated. Use A instead">-</warning> x2
x1 <warning descr="[DEPRECATION] 'div(MyClass): Unit' is deprecated. Use A instead">/</warning> x2
x1 <warning descr="[DEPRECATION] 'times(MyClass): Unit' is deprecated. Use A instead">*</warning> x2
<warning descr="[DEPRECATED_SYMBOL_WITH_MESSAGE] 'not(): Unit' is deprecated. Use A instead">!</warning>x1
<warning descr="[DEPRECATED_SYMBOL_WITH_MESSAGE] 'plus(): Unit' is deprecated. Use A instead">+</warning>x1
<warning descr="[DEPRECATION] 'not(): Unit' is deprecated. Use A instead">!</warning>x1
<warning descr="[DEPRECATION] 'plus(): Unit' is deprecated. Use A instead">+</warning>x1
x1 <warning descr="[DEPRECATED_SYMBOL_WITH_MESSAGE] 'contains(MyClass): Boolean' is deprecated. Use A instead">in</warning> x2
x1 <warning descr="[DEPRECATED_SYMBOL_WITH_MESSAGE] 'contains(MyClass): Boolean' is deprecated. Use A instead">!in</warning> x2
x1 <warning descr="[DEPRECATION] 'contains(MyClass): Boolean' is deprecated. Use A instead">in</warning> x2
x1 <warning descr="[DEPRECATION] 'contains(MyClass): Boolean' is deprecated. Use A instead">!in</warning> x2
x1 <warning descr="[DEPRECATED_SYMBOL_WITH_MESSAGE] 'plusAssign(MyClass): Unit' is deprecated. Use A instead">+=</warning> x2
x1 <warning descr="[DEPRECATION] 'plusAssign(MyClass): Unit' is deprecated. Use A instead">+=</warning> x2
x1<warning descr="[DEPRECATED_SYMBOL_WITH_MESSAGE] 'rangeTo(MyClass): IntRange' is deprecated. Use A instead">..</warning>x2
x1<warning descr="[DEPRECATION] 'rangeTo(MyClass): IntRange' is deprecated. Use A instead">..</warning>x2
}
// NO_CHECK_INFOS
// NO_CHECK_WEAK_WARNINGS
// NO_CHECK_WEAK_WARNINGS
+7 -7
View File
@@ -1,11 +1,11 @@
fun test() {
<warning descr="[DEPRECATED_SYMBOL_WITH_MESSAGE] 'test1: String' is deprecated. Use A instead">test1</warning> == ""
MyClass().<warning descr="[DEPRECATED_SYMBOL_WITH_MESSAGE] 'test2: String' is deprecated. Use A instead">test2</warning>
MyClass.<warning descr="[DEPRECATED_SYMBOL_WITH_MESSAGE] 'test3: String' is deprecated. Use A instead">test3</warning>
<warning descr="[DEPRECATION] 'test1: String' is deprecated. Use A instead">test1</warning> == ""
MyClass().<warning descr="[DEPRECATION] 'test2: String' is deprecated. Use A instead">test2</warning>
MyClass.<warning descr="[DEPRECATION] 'test3: String' is deprecated. Use A instead">test3</warning>
<warning descr="[DEPRECATED_SYMBOL_WITH_MESSAGE] 'test4: String' is deprecated. Use A instead">test4</warning> == ""
MyClass().<warning descr="[DEPRECATED_SYMBOL_WITH_MESSAGE] 'test5: String' is deprecated. Use A instead">test5</warning>
MyClass.<warning descr="[DEPRECATED_SYMBOL_WITH_MESSAGE] 'test6: String' is deprecated. Use A instead">test6</warning>
<warning descr="[DEPRECATION] 'test4: String' is deprecated. Use A instead">test4</warning> == ""
MyClass().<warning descr="[DEPRECATION] 'test5: String' is deprecated. Use A instead">test5</warning>
MyClass.<warning descr="[DEPRECATION] 'test6: String' is deprecated. Use A instead">test6</warning>
}
@Deprecated("Use A instead") val test1: String = ""
@@ -22,4 +22,4 @@ class MyClass() {
}
// NO_CHECK_INFOS
// NO_CHECK_WEAK_WARNINGS
// NO_CHECK_WEAK_WARNINGS
+1 -1
View File
@@ -11,7 +11,7 @@ fun test() {
val x1 = MyClass()
val x2 = MyClass()
for (i in x1<warning descr="[DEPRECATED_SYMBOL_WITH_MESSAGE] 'rangeTo(MyClass): Iterable<Int>' is deprecated. Use A instead">..</warning>x2) {
for (i in x1<warning descr="[DEPRECATION] 'rangeTo(MyClass): Iterable<Int>' is deprecated. Use A instead">..</warning>x2) {
}
}
+11 -11
View File
@@ -1,20 +1,20 @@
fun test() {
MyClass().test1
MyClass().<warning descr="[DEPRECATED_SYMBOL_WITH_MESSAGE] 'setter for test1: Int' is deprecated. Use A instead">test1</warning> = 0
MyClass().<warning descr="[DEPRECATION] 'setter for test1: Int' is deprecated. Use A instead">test1</warning> = 0
MyClass().<warning descr="[DEPRECATED_SYMBOL_WITH_MESSAGE] 'setter for test1: Int' is deprecated. Use A instead">test1</warning>++
MyClass().<warning descr="[DEPRECATED_SYMBOL_WITH_MESSAGE] 'setter for test1: Int' is deprecated. Use A instead">test1</warning>--
MyClass().<warning descr="[DEPRECATION] 'setter for test1: Int' is deprecated. Use A instead">test1</warning>++
MyClass().<warning descr="[DEPRECATION] 'setter for test1: Int' is deprecated. Use A instead">test1</warning>--
++MyClass().<warning descr="[DEPRECATED_SYMBOL_WITH_MESSAGE] 'setter for test1: Int' is deprecated. Use A instead">test1</warning>
--MyClass().<warning descr="[DEPRECATED_SYMBOL_WITH_MESSAGE] 'setter for test1: Int' is deprecated. Use A instead">test1</warning>
++MyClass().<warning descr="[DEPRECATION] 'setter for test1: Int' is deprecated. Use A instead">test1</warning>
--MyClass().<warning descr="[DEPRECATION] 'setter for test1: Int' is deprecated. Use A instead">test1</warning>
MyClass().<warning descr="[DEPRECATED_SYMBOL_WITH_MESSAGE] 'setter for test1: Int' is deprecated. Use A instead">test1</warning> += 1
MyClass().<warning descr="[DEPRECATED_SYMBOL_WITH_MESSAGE] 'setter for test1: Int' is deprecated. Use A instead">test1</warning> -= 1
MyClass().<warning descr="[DEPRECATED_SYMBOL_WITH_MESSAGE] 'setter for test1: Int' is deprecated. Use A instead">test1</warning> /= 1
MyClass().<warning descr="[DEPRECATED_SYMBOL_WITH_MESSAGE] 'setter for test1: Int' is deprecated. Use A instead">test1</warning> *= 1
MyClass().<warning descr="[DEPRECATION] 'setter for test1: Int' is deprecated. Use A instead">test1</warning> += 1
MyClass().<warning descr="[DEPRECATION] 'setter for test1: Int' is deprecated. Use A instead">test1</warning> -= 1
MyClass().<warning descr="[DEPRECATION] 'setter for test1: Int' is deprecated. Use A instead">test1</warning> /= 1
MyClass().<warning descr="[DEPRECATION] 'setter for test1: Int' is deprecated. Use A instead">test1</warning> *= 1
test2 + 1
<warning descr="[DEPRECATED_SYMBOL_WITH_MESSAGE] 'setter for test2: Int' is deprecated. Use A instead">test2</warning> = 10
<warning descr="[DEPRECATION] 'setter for test2: Int' is deprecated. Use A instead">test2</warning> = 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_CHECK_WEAK_WARNINGS
+5 -5
View File
@@ -1,14 +1,14 @@
@Deprecated("Use A instead") interface MyTrait { }
fun test() {
val a: <warning descr="[DEPRECATED_SYMBOL_WITH_MESSAGE] 'MyTrait' is deprecated. Use A instead">MyTrait</warning>? = null
val b: List<<warning descr="[DEPRECATED_SYMBOL_WITH_MESSAGE] 'MyTrait' is deprecated. Use A instead">MyTrait</warning>>? = null
val a: <warning descr="[DEPRECATION] 'MyTrait' is deprecated. Use A instead">MyTrait</warning>? = null
val b: List<<warning descr="[DEPRECATION] 'MyTrait' is deprecated. Use A instead">MyTrait</warning>>? = null
a == b
}
class Test(): <warning descr="[DEPRECATED_SYMBOL_WITH_MESSAGE] 'MyTrait' is deprecated. Use A instead">MyTrait</warning> { }
class Test(): <warning descr="[DEPRECATION] 'MyTrait' is deprecated. Use A instead">MyTrait</warning> { }
class Test2(<warning descr="[UNUSED_PARAMETER] Parameter 'param' is never used">param</warning>: <warning descr="[DEPRECATED_SYMBOL_WITH_MESSAGE] 'MyTrait' is deprecated. Use A instead">MyTrait</warning>) {}
class Test2(<warning descr="[UNUSED_PARAMETER] Parameter 'param' is never used">param</warning>: <warning descr="[DEPRECATION] 'MyTrait' is deprecated. Use A instead">MyTrait</warning>) {}
// NO_CHECK_INFOS
// NO_CHECK_WEAK_WARNINGS
// NO_CHECK_WEAK_WARNINGS