Backend: generate default values for annotation parameters in light classes mode
This commit is contained in:
@@ -203,11 +203,12 @@ public class PropertyCodegen {
|
|||||||
null
|
null
|
||||||
);
|
);
|
||||||
|
|
||||||
if (state.getClassBuilderMode() == ClassBuilderMode.FULL) {
|
KtExpression defaultValue = p.getDefaultValue();
|
||||||
KtExpression defaultValue = p.getDefaultValue();
|
if (defaultValue != null) {
|
||||||
if (defaultValue != null) {
|
ConstantValue<?> constant = ExpressionCodegen.getCompileTimeConstant(defaultValue, bindingContext);
|
||||||
ConstantValue<?> constant = ExpressionCodegen.getCompileTimeConstant(defaultValue, bindingContext);
|
assert state.getClassBuilderMode() != ClassBuilderMode.FULL || constant != null
|
||||||
assert constant != null : "Default value for annotation parameter should be compile time value: " + defaultValue.getText();
|
: "Default value for annotation parameter should be compile time value: " + defaultValue.getText();
|
||||||
|
if (constant != null) {
|
||||||
AnnotationCodegen annotationCodegen = AnnotationCodegen.forAnnotationDefaultValue(mv, typeMapper);
|
AnnotationCodegen annotationCodegen = AnnotationCodegen.forAnnotationDefaultValue(mv, typeMapper);
|
||||||
annotationCodegen.generateAnnotationDefaultValue(constant, descriptor.getType());
|
annotationCodegen.generateAnnotationDefaultValue(constant, descriptor.getType());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user