Java to Kotlin: dropped Node interface
This commit is contained in:
@@ -16,9 +16,10 @@
|
|||||||
|
|
||||||
package org.jetbrains.jet.j2k.ast
|
package org.jetbrains.jet.j2k.ast
|
||||||
|
|
||||||
|
trait Element {
|
||||||
|
public fun toKotlin(): String
|
||||||
|
|
||||||
trait Element : Node {
|
public val isEmpty: Boolean get() = false
|
||||||
val isEmpty: Boolean get() = false
|
|
||||||
|
|
||||||
object Empty : Element {
|
object Empty : Element {
|
||||||
override fun toKotlin() = ""
|
override fun toKotlin() = ""
|
||||||
|
|||||||
@@ -1,22 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2010-2013 JetBrains s.r.o.
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.jetbrains.jet.j2k.ast
|
|
||||||
|
|
||||||
|
|
||||||
trait Node {
|
|
||||||
public fun toKotlin(): String
|
|
||||||
}
|
|
||||||
@@ -18,7 +18,7 @@ package org.jetbrains.jet.j2k.ast
|
|||||||
|
|
||||||
import java.util.ArrayList
|
import java.util.ArrayList
|
||||||
|
|
||||||
fun List<Node>.toKotlin(separator: String, prefix: String = "", postfix: String = ""): String
|
fun List<Element>.toKotlin(separator: String, prefix: String = "", postfix: String = ""): String
|
||||||
= if (isNotEmpty()) map { it.toKotlin() }.makeString(separator, prefix, postfix) else ""
|
= if (isNotEmpty()) map { it.toKotlin() }.makeString(separator, prefix, postfix) else ""
|
||||||
|
|
||||||
fun String.withSuffix(suffix: String): String = if (isEmpty()) "" else this + suffix
|
fun String.withSuffix(suffix: String): String = if (isEmpty()) "" else this + suffix
|
||||||
|
|||||||
Reference in New Issue
Block a user