Do not report deprecation on members of deprecated companion
This deprecation is reported on the companion itself anyway
This commit is contained in:
@@ -112,7 +112,7 @@ private fun deprecationByOverridden(root: CallableMemberDescriptor): Deprecation
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
else -> {
|
else -> {
|
||||||
overriddenDescriptors.forEach { traverse(it) }
|
overriddenDescriptors.forEach(::traverse)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -147,13 +147,6 @@ private fun DeclarationDescriptor.getDeprecationByAnnotation(): DeprecatedByAnno
|
|||||||
val propertyAnnotation = propertyDescriptor.getDeclaredDeprecatedAnnotation()
|
val propertyAnnotation = propertyDescriptor.getDeclaredDeprecatedAnnotation()
|
||||||
if (propertyAnnotation != null)
|
if (propertyAnnotation != null)
|
||||||
return DeprecatedByAnnotation(propertyAnnotation, propertyDescriptor)
|
return DeprecatedByAnnotation(propertyAnnotation, propertyDescriptor)
|
||||||
|
|
||||||
val classDescriptor = containingDeclaration as? ClassDescriptor
|
|
||||||
if (classDescriptor != null && classDescriptor.isCompanionObject) {
|
|
||||||
val classAnnotation = classDescriptor.getDeclaredDeprecatedAnnotation()
|
|
||||||
if (classAnnotation != null)
|
|
||||||
return DeprecatedByAnnotation(classAnnotation, classDescriptor)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null
|
return null
|
||||||
|
|||||||
@@ -8,8 +8,8 @@ class Another {
|
|||||||
|
|
||||||
fun first() {
|
fun first() {
|
||||||
<!DEPRECATION!>Another<!>.use()
|
<!DEPRECATION!>Another<!>.use()
|
||||||
Another.<!DEPRECATION!>Companion<!>.<!DEPRECATION!>USE<!> // TODO
|
Another.<!DEPRECATION!>Companion<!>.USE
|
||||||
<!DEPRECATION!>Another<!>.<!DEPRECATION!>USE<!> // TODO
|
<!DEPRECATION!>Another<!>.USE
|
||||||
}
|
}
|
||||||
|
|
||||||
fun useCompanion() {
|
fun useCompanion() {
|
||||||
|
|||||||
+3
-3
@@ -1,13 +1,13 @@
|
|||||||
fun test() {
|
fun test() {
|
||||||
<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>
|
<warning descr="[DEPRECATION] 'companion object of MyClass' is deprecated. Use A instead">MyClass</warning>.test
|
||||||
MyClass()
|
MyClass()
|
||||||
val a: MyClass? = null
|
val a: MyClass? = null
|
||||||
val b: MyTrait? = null
|
val b: MyTrait? = null
|
||||||
<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>
|
<warning descr="[DEPRECATION] 'companion object of MyTrait' is deprecated. Use A instead">MyTrait</warning>.test
|
||||||
MyTrait.<warning descr="[DEPRECATION] 'companion object of MyTrait' is deprecated. Use A instead">Companion</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>
|
<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>
|
||||||
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>
|
MyClass.<warning descr="[DEPRECATION] 'companion object of MyClass' is deprecated. Use A instead">Companion</warning>.test
|
||||||
|
|
||||||
a == b
|
a == b
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user