J2K: generate 'interface' keyword instead of 'trait'

This commit is contained in:
Dmitry Jemerov
2015-05-11 19:36:22 +02:00
parent 69a58d1f0e
commit 25959fefdc
36 changed files with 39 additions and 39 deletions
@@ -27,7 +27,7 @@ class Trait(
) : Class(name, annotations, modifiers, typeParameterList, extendsTypes, null, implementsTypes, body) { ) : Class(name, annotations, modifiers, typeParameterList, extendsTypes, null, implementsTypes, body) {
override val keyword: String override val keyword: String
get() = "trait" get() = "interface"
override fun presentationModifiers(): Modifiers override fun presentationModifiers(): Modifiers
= modifiers.filter { it in ACCESS_MODIFIERS } = modifiers.filter { it in ACCESS_MODIFIERS }
@@ -13,7 +13,7 @@ annotation class Anon(public val value: String) {
} }
Anon("a") Anon("a")
trait I { interface I {
companion object { companion object {
public val e: Anon.E = Anon.field public val e: Anon.E = Anon.field
} }
@@ -1,13 +1,13 @@
annotation class Anon(public vararg val value: String, public val x: Int = 1) annotation class Anon(public vararg val value: String, public val x: Int = 1)
Anon("a", "b") Anon("a", "b")
trait I1 interface I1
Anon("c", "d", x = 1) Anon("c", "d", x = 1)
trait I2 interface I2
Anon("c", "d", x = 1) Anon("c", "d", x = 1)
trait I3 interface I3
Anon(value = *array("c", "d")) Anon(value = *array("c", "d"))
trait I4 interface I4
@@ -1,3 +1,3 @@
trait A { interface A {
public class B public class B
} }
@@ -1,3 +1,3 @@
class A { class A {
trait I interface I
} }
@@ -1,4 +1,4 @@
trait I { interface I {
public fun getX(): Int public fun getX(): Int
public fun setX(x: Int) public fun setX(x: Int)
} }
+1 -1
View File
@@ -1,4 +1,4 @@
trait I interface I
class C { class C {
fun foo1(i1: I, i2: I): Boolean { fun foo1(i1: I, i2: I): Boolean {
@@ -1,6 +1,6 @@
import java.util.Objects import java.util.Objects
trait I interface I
class C { class C {
fun foo1(i1: I, i2: I): Boolean { fun foo1(i1: I, i2: I): Boolean {
@@ -23,7 +23,7 @@ class C : B() {
} }
} }
trait I { interface I {
public fun f() public fun f()
} }
@@ -1,4 +1,4 @@
trait I { interface I {
public fun getString(): String? public fun getString(): String?
} }
@@ -1,4 +1,4 @@
trait I { interface I {
public fun getString(): String? public fun getString(): String?
} }
@@ -1,4 +1,4 @@
trait I { interface I {
public fun getString(): String? public fun getString(): String?
} }
@@ -1,4 +1,4 @@
trait I { interface I {
public fun getString(): String public fun getString(): String
} }
@@ -1,5 +1,5 @@
// ERROR: Return type of 'get' is not a subtype of the return type of overridden member public abstract fun get(): kotlin.String defined in Getter // ERROR: Return type of 'get' is not a subtype of the return type of overridden member public abstract fun get(): kotlin.String defined in Getter
trait Getter { interface Getter {
public fun get(): String public fun get(): String
} }
@@ -12,7 +12,7 @@ open class Base {
} }
} }
trait I { interface I {
public fun zoo(o: Any?): String? public fun zoo(o: Any?): String?
} }
@@ -1,6 +1,6 @@
package demo package demo
trait WindowListener { interface WindowListener {
public fun windowClosing() public fun windowClosing()
} }
@@ -1,4 +1,4 @@
trait I { interface I {
public fun foo(i: Int, c: Char, s: String) public fun foo(i: Int, c: Char, s: String)
public fun bar() public fun bar()
} }
@@ -1,4 +1,4 @@
trait I { interface I {
public fun getInt(): Int public fun getInt(): Int
} }
@@ -20,7 +20,7 @@ abstract class C {
abstract fun foo() abstract fun foo()
} }
trait I { interface I {
public fun foo() public fun foo()
} }
@@ -1,5 +1,5 @@
import java.util.* import java.util.*
trait I<T : List<Iterator<String>>> interface I<T : List<Iterator<String>>>
class C : I<ArrayList<Iterator<String>>> class C : I<ArrayList<Iterator<String>>>
@@ -1 +1 @@
trait I interface I
@@ -1 +1 @@
trait A interface A
@@ -1 +1 @@
trait A : I0, I1, I2 interface A : I0, I1, I2
@@ -1 +1 @@
trait A : I interface A : I
@@ -1,4 +1,4 @@
trait INode { interface INode {
companion object { companion object {
public val IN: String = "in" public val IN: String = "in"
public val AT: String = "@" public val AT: String = "@"
@@ -1,4 +1,4 @@
trait INode { interface INode {
public fun getTag(): Tag public fun getTag(): Tag
public fun toKotlin(): String public fun toKotlin(): String
} }
@@ -1,4 +1,4 @@
public trait INode { public interface INode {
companion object { companion object {
public val IN: String = "in" public val IN: String = "in"
public val AT: String = "@" public val AT: String = "@"
@@ -1 +1 @@
trait Test interface Test
@@ -1 +1 @@
private trait Test private interface Test
@@ -1 +1 @@
protected trait Test protected interface Test
@@ -1 +1 @@
public trait Test public interface Test
@@ -1,6 +1,6 @@
import java.io.* import java.io.*
trait I { interface I {
throws(IOException::class) throws(IOException::class)
public fun doIt(stream: InputStream): Int public fun doIt(stream: InputStream): Int
} }
@@ -1,6 +1,6 @@
import java.io.* import java.io.*
trait I { interface I {
throws(IOException::class) throws(IOException::class)
public fun doIt(stream: InputStream): Int public fun doIt(stream: InputStream): Int
} }
@@ -1 +1 @@
trait CommandHandler<T : Command> interface CommandHandler<T : Command>
@@ -1 +1 @@
trait CommandHandler<T : INode, String> interface CommandHandler<T : INode, String>
@@ -1 +1 @@
trait I<T : INode, K : Node> : II where T : Comparable<T>, K : Collection<in K> interface I<T : INode, K : Node> : II where T : Comparable<T>, K : Collection<in K>