New J2K: Add temporary sorting of class declarations

This commit is contained in:
Ilya Kirillov
2018-11-09 11:03:58 +03:00
committed by Ilya Kirillov
parent 03df0f1164
commit 61d6709cb7
2 changed files with 20 additions and 0 deletions
@@ -54,6 +54,7 @@ object ConversionsRunner {
+InstanceOfConversion()
+ForConversion(context)
+LabeledStatementConversion()
+SortClassMembersConversion()
}
fun doApply(trees: List<JKTreeElement>, context: ConversionContext) {
@@ -0,0 +1,19 @@
/*
* Copyright 2010-2018 JetBrains s.r.o. 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.j2k.conversions
import org.jetbrains.kotlin.j2k.ast.EnumConstant
import org.jetbrains.kotlin.j2k.tree.*
//TODO temporary
class SortClassMembersConversion : RecursiveApplicableConversionBase() {
override fun applyToElement(element: JKTreeElement): JKTreeElement {
if (element !is JKClass) return recurse(element)
element.declarationList = element.declarationList
.sortedByDescending { it is JKField }
return recurse(element)
}
}