Generate private constructors for Enums
#KT-2680 Fixed #KT-16867 Fixed
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
// FILE: Foo.java
|
||||
|
||||
public class Foo {
|
||||
|
||||
static String test() {
|
||||
return KEnum.O.name() + KEnum.O.getValue();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// FILE: KEnum.kt
|
||||
@Retention(AnnotationRetention.RUNTIME)
|
||||
annotation class A
|
||||
|
||||
enum class KEnum(@A val value: Any) {
|
||||
O("K")
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
return Foo.test();
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
// FILE: Foo.java
|
||||
|
||||
public class Foo {
|
||||
|
||||
static String test() {
|
||||
return KEnum.O.name() + KEnum.O.getValue();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// FILE: KEnum.kt
|
||||
@Retention(AnnotationRetention.RUNTIME)
|
||||
annotation class A
|
||||
|
||||
enum class KEnum(@A val value: Any) {
|
||||
O("K") {
|
||||
fun foo() {}
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
return Foo.test()
|
||||
}
|
||||
Reference in New Issue
Block a user