diff --git a/compiler/backend/src/org/jetbrains/jet/codegen/ClassBodyCodegen.java b/compiler/backend/src/org/jetbrains/jet/codegen/ClassBodyCodegen.java index f6454b79e9c..6bf4ce123b4 100644 --- a/compiler/backend/src/org/jetbrains/jet/codegen/ClassBodyCodegen.java +++ b/compiler/backend/src/org/jetbrains/jet/codegen/ClassBodyCodegen.java @@ -135,17 +135,7 @@ public abstract class ClassBodyCodegen extends MemberCodegen { propertyCodegen.generatePrimaryConstructorProperty(p, propertyDescriptor); } else { - Type type = state.getTypeMapper().mapType(propertyDescriptor); - MethodVisitor visitor = - v.newMethod(p, ACC_PUBLIC | ACC_ABSTRACT, p.getName(), "()" + type.getDescriptor(), null, null); - JetExpression defaultValue = p.getDefaultValue(); - if (defaultValue != null) { - CompileTimeConstant constant = - state.getBindingContext().get(BindingContext.COMPILE_TIME_VALUE, defaultValue); - assert constant != null : "Default value for annotation parameter should be compile time value: " + defaultValue.getText(); - AnnotationCodegen annotationCodegen = AnnotationCodegen.forAnnotationDefaultValue(visitor, typeMapper); - annotationCodegen.generateAnnotationDefaultValue(constant); - } + propertyCodegen.generateConstructorPropertyAsMethodForAnnotationClass(p, propertyDescriptor); } } } diff --git a/compiler/backend/src/org/jetbrains/jet/codegen/PropertyCodegen.java b/compiler/backend/src/org/jetbrains/jet/codegen/PropertyCodegen.java index 7ef0cf02f4f..e114b06476b 100644 --- a/compiler/backend/src/org/jetbrains/jet/codegen/PropertyCodegen.java +++ b/compiler/backend/src/org/jetbrains/jet/codegen/PropertyCodegen.java @@ -104,6 +104,20 @@ public class PropertyCodegen extends GenerationStateAware { } } + public void generateConstructorPropertyAsMethodForAnnotationClass(JetParameter p, PropertyDescriptor descriptor) { + Type type = state.getTypeMapper().mapType(descriptor); + MethodVisitor visitor = + v.newMethod(p, ACC_PUBLIC | ACC_ABSTRACT, p.getName(), "()" + type.getDescriptor(), null, null); + JetExpression defaultValue = p.getDefaultValue(); + if (defaultValue != null) { + CompileTimeConstant constant = + state.getBindingContext().get(BindingContext.COMPILE_TIME_VALUE, defaultValue); + assert constant != null : "Default value for annotation parameter should be compile time value: " + defaultValue.getText(); + AnnotationCodegen annotationCodegen = AnnotationCodegen.forAnnotationDefaultValue(visitor, typeMapper); + annotationCodegen.generateAnnotationDefaultValue(constant); + } + } + private void generateBackingField(JetNamedDeclaration p, PropertyDescriptor propertyDescriptor) { //noinspection ConstantConditions boolean hasBackingField = bindingContext.get(BindingContext.BACKING_FIELD_REQUIRED, propertyDescriptor);