Support any constant expressions as annotation arguments

This commit is contained in:
Alexander Udalov
2013-09-02 23:03:08 +04:00
parent a17328f9d3
commit e62a2bbf2f
11 changed files with 135 additions and 12 deletions
@@ -0,0 +1,10 @@
package test;
public class AnnotationWithArithmeticExpressionInParam {
public @interface Anno {
int value();
}
@Anno(2 * 8 + 13 * (239 - 237))
public static class Class {}
}
@@ -0,0 +1,14 @@
package test
public open class AnnotationWithArithmeticExpressionInParam : java.lang.Object {
public constructor AnnotationWithArithmeticExpressionInParam()
public final annotation class Anno : jet.Annotation {
public constructor Anno(/*0*/ value: jet.Int)
public abstract fun value(): jet.Int
}
test.AnnotationWithArithmeticExpressionInParam.Anno(value = 42.toInt(): jet.Int) public open class Class : java.lang.Object {
public constructor Class()
}
}
@@ -0,0 +1,10 @@
package test;
public interface AnnotationWithStringConcatenationInParam {
public @interface Anno {
String value();
}
@Anno("he" + "l" + "lo")
public static class Class { }
}
@@ -0,0 +1,13 @@
package test
public trait AnnotationWithStringConcatenationInParam : java.lang.Object {
public final annotation class Anno : jet.Annotation {
public constructor Anno(/*0*/ value: jet.String?)
public abstract fun value(): jet.String?
}
test.AnnotationWithStringConcatenationInParam.Anno(value = "hello": jet.String) public open class Class : java.lang.Object {
public constructor Class()
}
}
@@ -0,0 +1,12 @@
package test;
public interface AnnotationWithStringConstantInParam {
public static final String HEL = "hel";
public @interface Anno {
String value();
}
@Anno(HEL + "lo")
public static class Class { }
}
@@ -0,0 +1,17 @@
package test
public trait AnnotationWithStringConstantInParam : java.lang.Object {
public final annotation class Anno : jet.Annotation {
public constructor Anno(/*0*/ value: jet.String?)
public abstract fun value(): jet.String?
}
test.AnnotationWithStringConstantInParam.Anno(value = "hello": jet.String) public open class Class : java.lang.Object {
public constructor Class()
}
}
package AnnotationWithStringConstantInParam {
public val HEL: jet.String
}
@@ -0,0 +1,10 @@
package test;
public interface AnnotationWithStringInParam {
public @interface Anno {
String value();
}
@Anno("hello")
public static class Class { }
}
@@ -0,0 +1,13 @@
package test
public trait AnnotationWithStringInParam : java.lang.Object {
public final annotation class Anno : jet.Annotation {
public constructor Anno(/*0*/ value: jet.String?)
public abstract fun value(): jet.String?
}
test.AnnotationWithStringInParam.Anno(value = "hello": jet.String) public open class Class : java.lang.Object {
public constructor Class()
}
}