New J2K: remove static modifier for the case when member is converted without containing class

This commit is contained in:
Ilya Kirillov
2019-06-10 19:26:58 +03:00
parent 9929dba74d
commit ce569ca6e0
2 changed files with 21 additions and 0 deletions
@@ -78,6 +78,7 @@ object ConversionsRunner {
+StaticsToCompanionExtractConversion()
+InterfaceWithFieldConversion()
+ClassToObjectPromotionConversion(context)
+RemoveWrongExtraModifiersForSingleFunctionsConversion()
+MethodReferenceToLambdaConversion(context)
+BuiltinMembersConversion(context)
+ImplicitCastsConversion(context)
@@ -0,0 +1,20 @@
/*
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.nj2k.conversions
import org.jetbrains.kotlin.nj2k.tree.*
class RemoveWrongExtraModifiersForSingleFunctionsConversion : RecursiveApplicableConversionBase() {
override fun applyToElement(element: JKTreeElement): JKTreeElement {
if (element !is JKExtraModifiersOwner) return recurse(element)
if (element.parentOfType<JKClass>() == null) {
element.elementByModifier(ExtraModifier.STATIC)?.also { modifierElement ->
element.extraModifierElements -= modifierElement
}
}
return recurse(element)
}
}