Rewrite slice error removed for LEAKING_THIS #KT-13371 Fixed

Also EA-86478 fixed
(cherry picked from commit 5ac3126)
This commit is contained in:
Mikhail Glukhikh
2016-08-08 14:32:59 +03:00
committed by Mikhail Glukhikh
parent 13e64c18d9
commit 729de536de
5 changed files with 38 additions and 6 deletions
@@ -43,7 +43,6 @@ class LeakingThisInspection : AbstractKotlinInspection() {
val context = expression.analyzeFully()
val leakingThisDescriptor = context.get(LEAKING_THIS, expression) ?: return
val description = when (leakingThisDescriptor) {
is PropertyIsNull -> return // Not supported yet
is NonFinalClass ->
if (expression is KtThisExpression)
"Leaking 'this' in constructor of non-final class ${leakingThisDescriptor.klass.name}"
@@ -53,6 +52,7 @@ class LeakingThisInspection : AbstractKotlinInspection() {
"Accessing non-final property ${leakingThisDescriptor.property.name} in constructor"
is NonFinalFunction ->
"Calling non-final function ${leakingThisDescriptor.function.name} in constructor"
else -> return // Not supported yet
}
val memberDescriptorToFix = when (leakingThisDescriptor) {
is NonFinalProperty -> leakingThisDescriptor.property