J2K: updating generated enums to modern syntax
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
package demo
|
||||
|
||||
enum class MyEnum private constructor(public val color: Int) {
|
||||
RED : MyEnum(10)
|
||||
BLUE : MyEnum(20)
|
||||
RED(10),
|
||||
BLUE(20)
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
public enum class TestEnum {
|
||||
A
|
||||
B
|
||||
A,
|
||||
B;
|
||||
|
||||
|
||||
companion object {
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
enum class E {
|
||||
FOO
|
||||
FOO;
|
||||
|
||||
fun foo() {
|
||||
FOO.toString()
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
enum class E {
|
||||
I
|
||||
|
||||
I;
|
||||
private val name: String? = null
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
enum class Color private constructor(public val code: Int) {
|
||||
WHITE : Color(21)
|
||||
BLACK : Color(22)
|
||||
RED : Color(23)
|
||||
YELLOW : Color(24)
|
||||
BLUE : Color(25)
|
||||
WHITE(21),
|
||||
BLACK(22),
|
||||
RED(23),
|
||||
YELLOW(24),
|
||||
BLUE(25)
|
||||
}
|
||||
@@ -1,10 +1,9 @@
|
||||
enum class Color {
|
||||
WHITE
|
||||
BLACK
|
||||
RED
|
||||
YELLOW
|
||||
BLUE
|
||||
|
||||
WHITE,
|
||||
BLACK,
|
||||
RED,
|
||||
YELLOW,
|
||||
BLUE;
|
||||
override fun toString(): String {
|
||||
return "COLOR"
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
enum class Color : Runnable {
|
||||
WHITE
|
||||
BLACK
|
||||
RED
|
||||
YELLOW
|
||||
BLUE
|
||||
WHITE,
|
||||
BLACK,
|
||||
RED,
|
||||
YELLOW,
|
||||
BLUE;
|
||||
|
||||
override fun run() {
|
||||
println("name()=" + name() + ", toString()=" + toString())
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
enum class Coin {
|
||||
PENNY
|
||||
NICKEL
|
||||
DIME
|
||||
PENNY,
|
||||
NICKEL,
|
||||
DIME,
|
||||
QUARTER
|
||||
}
|
||||
Reference in New Issue
Block a user