Use AnnotationSplitter for annotations on setter parameter
Make it possible to specify annotations of the setter parameter when constructing the default setter via DescriptorFactory; pass the split annotations in DescriptorResolver.resolvePropertySetterDescriptor #KT-25500 Fixed
This commit is contained in:
@@ -533,21 +533,10 @@ public class FunctionCodegen {
|
||||
}
|
||||
|
||||
if (kind == JvmMethodParameterKind.VALUE) {
|
||||
ValueParameterDescriptor parameter = iterator.next();
|
||||
AnnotationCodegen annotationCodegen = AnnotationCodegen.forParameter(i, mv, innerClassConsumer, typeMapper);
|
||||
|
||||
if (functionDescriptor instanceof PropertySetterDescriptor) {
|
||||
PropertyDescriptor propertyDescriptor = ((PropertySetterDescriptor) functionDescriptor).getCorrespondingProperty();
|
||||
Annotated targetedAnnotations = new AnnotatedWithOnlyTargetedAnnotations(propertyDescriptor);
|
||||
annotationCodegen.genAnnotations(targetedAnnotations, parameterSignature.getAsmType(), SETTER_PARAMETER);
|
||||
}
|
||||
|
||||
if (functionDescriptor instanceof ConstructorDescriptor) {
|
||||
annotationCodegen.genAnnotations(parameter, parameterSignature.getAsmType(), CONSTRUCTOR_PARAMETER);
|
||||
}
|
||||
else {
|
||||
annotationCodegen.genAnnotations(parameter, parameterSignature.getAsmType());
|
||||
}
|
||||
AnnotationCodegen.forParameter(i, mv, innerClassConsumer, typeMapper).genAnnotations(
|
||||
iterator.next(),
|
||||
parameterSignature.getAsmType()
|
||||
);
|
||||
}
|
||||
else if (kind == JvmMethodParameterKind.RECEIVER) {
|
||||
ReceiverParameterDescriptor receiver = JvmCodegenUtil.getDirectMember(functionDescriptor).getExtensionReceiverParameter();
|
||||
|
||||
@@ -503,12 +503,18 @@ public class PropertyCodegen {
|
||||
: DescriptorFactory.createDefaultGetter(descriptor, Annotations.Companion.getEMPTY()));
|
||||
}
|
||||
|
||||
public void generateSetter(@Nullable KtNamedDeclaration p, @NotNull PropertyDescriptor descriptor, @Nullable KtPropertyAccessor setter) {
|
||||
public void generateSetter(
|
||||
@Nullable KtNamedDeclaration p,
|
||||
@NotNull PropertyDescriptor descriptor,
|
||||
@Nullable KtPropertyAccessor setter
|
||||
) {
|
||||
if (!descriptor.isVar()) return;
|
||||
|
||||
generateAccessor(p, setter, descriptor.getSetter() != null
|
||||
? descriptor.getSetter()
|
||||
: DescriptorFactory.createDefaultSetter(descriptor, Annotations.Companion.getEMPTY()));
|
||||
: DescriptorFactory.createDefaultSetter(
|
||||
descriptor, Annotations.Companion.getEMPTY(), Annotations.Companion.getEMPTY()
|
||||
));
|
||||
}
|
||||
|
||||
private void generateAccessor(
|
||||
|
||||
Reference in New Issue
Block a user