New J2K: remove static modifier for the case when member is converted without containing class
This commit is contained in:
@@ -78,6 +78,7 @@ object ConversionsRunner {
|
||||
+StaticsToCompanionExtractConversion()
|
||||
+InterfaceWithFieldConversion()
|
||||
+ClassToObjectPromotionConversion(context)
|
||||
+RemoveWrongExtraModifiersForSingleFunctionsConversion()
|
||||
+MethodReferenceToLambdaConversion(context)
|
||||
+BuiltinMembersConversion(context)
|
||||
+ImplicitCastsConversion(context)
|
||||
|
||||
+20
@@ -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)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user