New J2K: fix incorrectly removed line break before constructor comment

That caused class body brace to be under the comment

#KT-35478 fixed
This commit is contained in:
Ilya Kirillov
2020-01-09 16:43:33 +03:00
parent 7bfad12e6a
commit b83a529b77
@@ -6,6 +6,7 @@
package org.jetbrains.kotlin.nj2k.postProcessing.processings
import com.intellij.psi.PsiElement
import com.intellij.psi.PsiWhiteSpace
import com.intellij.psi.search.searches.ReferencesSearch
import org.jetbrains.kotlin.descriptors.CallableDescriptor
import org.jetbrains.kotlin.descriptors.VariableDescriptor
@@ -297,7 +298,11 @@ class RemoveRedundantConstructorKeywordProcessing :
override fun apply(element: KtPrimaryConstructor) {
element.removeRedundantConstructorKeywordAndSpace()
element.getConstructorKeyword()?.delete()
element.prevSibling
?.safeAs<PsiWhiteSpace>()
?.takeUnless { it.textContains('\n') }
?.delete()
}
}