From 896246a7f54d4a547956ecf8a73054bebd90c863 Mon Sep 17 00:00:00 2001 From: Dmitry Jemerov Date: Thu, 28 Dec 2017 14:26:06 +0100 Subject: [PATCH] More cleanup after J2K --- .../asJava/elements/KtLightParameter.kt | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/compiler/light-classes/src/org/jetbrains/kotlin/asJava/elements/KtLightParameter.kt b/compiler/light-classes/src/org/jetbrains/kotlin/asJava/elements/KtLightParameter.kt index 1855567890e..048bb0b3570 100644 --- a/compiler/light-classes/src/org/jetbrains/kotlin/asJava/elements/KtLightParameter.kt +++ b/compiler/light-classes/src/org/jetbrains/kotlin/asJava/elements/KtLightParameter.kt @@ -46,18 +46,14 @@ class KtLightParameter( if (jetIndex != 0) return null - var setter: KtPropertyAccessor? = null - if (declaration is KtPropertyAccessor) { - setter = if (declaration.isSetter) declaration else null - } - else if (declaration is KtProperty) { - setter = declaration.setter - } - else if (declaration is KtParameter) { - return declaration + val setter = when (declaration) { + is KtPropertyAccessor -> if (declaration.isSetter) declaration else null + is KtProperty -> declaration.setter + is KtParameter -> return declaration + else -> return null } - return if (setter != null) setter.parameter else null + return setter?.parameter } init { @@ -106,8 +102,7 @@ class KtLightParameter( val result = ApplicationManager.getApplication().runReadAction(Computable { val kotlinOrigin = kotlinOrigin if (another is KtLightParameter && kotlinOrigin != null) { - val anotherParam = another as KtLightParameter? - kotlinOrigin == anotherParam!!.kotlinOrigin && clsDelegate == anotherParam.clsDelegate + kotlinOrigin == another.kotlinOrigin && clsDelegate == another.clsDelegate } else { null