Partial fix for KT-3698: properly write field initializer

This commit is contained in:
Mikhael Bogdanov
2013-06-19 15:27:11 +04:00
parent 935c5ec16d
commit 132d74200b
11 changed files with 154 additions and 12 deletions
@@ -0,0 +1,10 @@
@AString(value = Test.vstring)
@AStringNullable(value = Test.vstringNullable)
@AChar(value = Test.vchar)
@AInt(value = Test.vint)
@AByte(value = Test.vbyte)
@ALong(value = Test.vlong)
@ADouble(value = Test.vdouble)
@AFloat(value = Test.vfloat)
public class AnnotationClass {
}
@@ -0,0 +1,23 @@
annotation class AString(val value: String)
annotation class AStringNullable(val value: String?)
annotation class AChar(val value: Char)
annotation class AInt(val value: Int)
annotation class AByte(val value: Byte)
annotation class ALong(val value: Long)
annotation class ADouble(val value: Double)
annotation class AFloat(val value: Float)
class Test {
class object {
val vstring: String = "Test"
val vstringNullable: String? = "Test"
val vchar: Char = 'c'
val vint: Int = 10
val vbyte: Byte = 11
val vlong: Long = 12
val vdouble: Double = 1.2
val vfloat: Float = 1.3
}
}
@@ -0,0 +1,10 @@
@AString(value = Test.vstring)
@AStringNullable(value = Test.vstringNullable)
@AChar(value = Test.vchar)
@AInt(value = Test.vint)
@AByte(value = Test.vbyte)
@ALong(value = Test.vlong)
@ADouble(value = Test.vdouble)
@AFloat(value = Test.vfloat)
public class AnnotationTrait {
}
@@ -0,0 +1,23 @@
annotation class AString(val value: String)
annotation class AStringNullable(val value: String?)
annotation class AChar(val value: Char)
annotation class AInt(val value: Int)
annotation class AByte(val value: Byte)
annotation class ALong(val value: Long)
annotation class ADouble(val value: Double)
annotation class AFloat(val value: Float)
trait Test {
class object {
val vstring: String = "Test"
val vstringNullable: String? = "Test"
val vchar: Char = 'c'
val vint: Int = 10
val vbyte: Byte = 11
val vlong: Long = 12
val vdouble: Double = 1.2
val vfloat: Float = 1.3
}
}
@@ -0,0 +1,11 @@
public class kt3698 {
@interface Foo {
int value();
}
@Foo(KotlinClass.FOO) // Error here
public static void main(String[] args) {
System.out.println(KotlinClass.FOO);
}
}
@@ -0,0 +1,5 @@
class KotlinClass {
class object {
val FOO: Int = 10
}
}