From 255bbbbfa8dd73eab0ecd2123ca6774d37855d68 Mon Sep 17 00:00:00 2001 From: Stanislav Erokhin Date: Wed, 8 Dec 2021 14:59:07 +0100 Subject: [PATCH] Restore binary compatibility with android.nav.safearg plugin In recent a39fbd38227c25e0906b5530d1315011c8737b9c commit contextReceiverParameters was introduced and new parameter to descriptor methods was added. Luckily, it is low-level methods enough -- i.e. they related to new descriptor creation, but still, some compatibility is broken. This commit fixes usages in the android.nav.safearg that I have found in the IDEA repo, maybe we will find other after some compatibility testing. --- .../impl/PropertyDescriptorImpl.java | 11 +++++++++++ .../impl/SimpleFunctionDescriptorImpl.java | 17 +++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/core/descriptors/src/org/jetbrains/kotlin/descriptors/impl/PropertyDescriptorImpl.java b/core/descriptors/src/org/jetbrains/kotlin/descriptors/impl/PropertyDescriptorImpl.java index 70059dcff46..f14771637a6 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/descriptors/impl/PropertyDescriptorImpl.java +++ b/core/descriptors/src/org/jetbrains/kotlin/descriptors/impl/PropertyDescriptorImpl.java @@ -120,6 +120,17 @@ public class PropertyDescriptorImpl extends VariableDescriptorWithInitializerImp return setter != null ? setter.getValueParameters().get(0).getType() : null; } + @kotlin.Deprecated(message = "This method is left for binary compatibility with android.nav.safearg plugin. Used in SafeArgSyntheticDescriptorGenerator.kt") + public void setType( + @NotNull KotlinType outType, + @ReadOnly @NotNull List typeParameters, + @Nullable ReceiverParameterDescriptor dispatchReceiverParameter, + @Nullable ReceiverParameterDescriptor extensionReceiverParameter + ) { + setType(outType, typeParameters, dispatchReceiverParameter, extensionReceiverParameter, + Collections.emptyList()); + } + public void setType( @NotNull KotlinType outType, @ReadOnly @NotNull List typeParameters, diff --git a/core/descriptors/src/org/jetbrains/kotlin/descriptors/impl/SimpleFunctionDescriptorImpl.java b/core/descriptors/src/org/jetbrains/kotlin/descriptors/impl/SimpleFunctionDescriptorImpl.java index 878e12edc53..5047dfb24f3 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/descriptors/impl/SimpleFunctionDescriptorImpl.java +++ b/core/descriptors/src/org/jetbrains/kotlin/descriptors/impl/SimpleFunctionDescriptorImpl.java @@ -16,6 +16,7 @@ package org.jetbrains.kotlin.descriptors.impl; +import kotlin.DeprecationLevel; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.kotlin.descriptors.*; @@ -23,6 +24,7 @@ import org.jetbrains.kotlin.descriptors.annotations.Annotations; import org.jetbrains.kotlin.name.Name; import org.jetbrains.kotlin.types.KotlinType; +import java.util.Collections; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; @@ -50,6 +52,21 @@ public class SimpleFunctionDescriptorImpl extends FunctionDescriptorImpl impleme return new SimpleFunctionDescriptorImpl(containingDeclaration, null, annotations, name, kind, source); } + @NotNull + @kotlin.Deprecated(message = "This method is left for binary compatibility with android.nav.safearg plugin. Used in SafeArgSyntheticDescriptorGenerator.kt") + public SimpleFunctionDescriptorImpl initialize( + @Nullable ReceiverParameterDescriptor extensionReceiverParameter, + @Nullable ReceiverParameterDescriptor dispatchReceiverParameter, + @NotNull List typeParameters, + @NotNull List unsubstitutedValueParameters, + @Nullable KotlinType unsubstitutedReturnType, + @Nullable Modality modality, + @NotNull DescriptorVisibility visibility + ) { + return initialize(extensionReceiverParameter, dispatchReceiverParameter, Collections.emptyList(), + typeParameters, unsubstitutedValueParameters, unsubstitutedReturnType, modality, visibility, null); + } + @NotNull @Override public SimpleFunctionDescriptorImpl initialize(