Backend: generate default values for annotation parameters in light classes mode

This commit is contained in:
Pavel V. Talanov
2015-10-28 15:25:26 +03:00
parent 0b11dc1d7f
commit 4a3632f70e
@@ -203,11 +203,12 @@ public class PropertyCodegen {
null
);
if (state.getClassBuilderMode() == ClassBuilderMode.FULL) {
KtExpression defaultValue = p.getDefaultValue();
if (defaultValue != null) {
ConstantValue<?> constant = ExpressionCodegen.getCompileTimeConstant(defaultValue, bindingContext);
assert constant != null : "Default value for annotation parameter should be compile time value: " + defaultValue.getText();
KtExpression defaultValue = p.getDefaultValue();
if (defaultValue != null) {
ConstantValue<?> constant = ExpressionCodegen.getCompileTimeConstant(defaultValue, bindingContext);
assert state.getClassBuilderMode() != ClassBuilderMode.FULL || constant != null
: "Default value for annotation parameter should be compile time value: " + defaultValue.getText();
if (constant != null) {
AnnotationCodegen annotationCodegen = AnnotationCodegen.forAnnotationDefaultValue(mv, typeMapper);
annotationCodegen.generateAnnotationDefaultValue(constant, descriptor.getType());
}