Remove compiler support for kotlin-annotations-android

#KT-44815
This commit is contained in:
Alexander Udalov
2021-02-09 14:00:17 +01:00
parent a884555171
commit 3432f581cb
14 changed files with 28 additions and 285 deletions
@@ -22,12 +22,10 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.kotlin.builtins.KotlinBuiltIns;
import org.jetbrains.kotlin.descriptors.*;
import org.jetbrains.kotlin.descriptors.annotations.AnnotationDescriptor;
import org.jetbrains.kotlin.descriptors.annotations.Annotations;
import org.jetbrains.kotlin.descriptors.impl.ValueParameterDescriptorImpl;
import org.jetbrains.kotlin.incremental.components.NoLookupLocation;
import org.jetbrains.kotlin.load.java.descriptors.JavaMethodDescriptor;
import org.jetbrains.kotlin.load.java.descriptors.UtilKt;
import org.jetbrains.kotlin.load.java.structure.JavaMethod;
import org.jetbrains.kotlin.name.Name;
import org.jetbrains.kotlin.resolve.DescriptorUtils;
@@ -68,12 +66,10 @@ public class SignaturesPropagationData {
JavaMethodDescriptor autoMethodDescriptor =
createAutoMethodDescriptor(containingClass, method, autoReturnType, autoValueParameters, autoTypeParameters);
boolean hasStableParameterNames = autoValueParameters.stream().allMatch(it -> UtilKt.getParameterNameAnnotation(it) != null);
superFunctions = getSuperFunctionsForMethod(method, autoMethodDescriptor, containingClass);
modifiedValueParameters = superFunctions.isEmpty()
? new ValueParameters(null, autoValueParameters, hasStableParameterNames)
: modifyValueParametersAccordingToSuperMethods(autoValueParameters, hasStableParameterNames);
? new ValueParameters(null, autoValueParameters, false)
: modifyValueParametersAccordingToSuperMethods(autoValueParameters);
}
@NotNull
@@ -123,10 +119,7 @@ public class SignaturesPropagationData {
signatureErrors.add(error);
}
private ValueParameters modifyValueParametersAccordingToSuperMethods(
@NotNull List<ValueParameterDescriptor> parameters,
boolean annotatedWithParameterName
) {
private ValueParameters modifyValueParametersAccordingToSuperMethods(@NotNull List<ValueParameterDescriptor> parameters) {
KotlinType resultReceiverType = null;
List<ValueParameterDescriptor> resultParameters = new ArrayList<>(parameters.size());
@@ -167,15 +160,12 @@ public class SignaturesPropagationData {
}
}
AnnotationDescriptor currentName = UtilKt.getParameterNameAnnotation(originalParam);
boolean shouldTakeOldName = currentName == null && stableName != null;
resultParameters.add(new ValueParameterDescriptorImpl(
originalParam.getContainingDeclaration(),
null,
shouldBeExtension ? originalIndex - 1 : originalIndex,
originalParam.getAnnotations(),
shouldTakeOldName ? stableName : originalParam.getName(),
stableName != null ? stableName : originalParam.getName(),
altType,
originalParam.declaresDefaultValue(),
originalParam.isCrossinline(),
@@ -186,8 +176,7 @@ public class SignaturesPropagationData {
}
}
boolean hasStableParameterNames =
annotatedWithParameterName || CollectionsKt.any(superFunctions, CallableDescriptor::hasStableParameterNames);
boolean hasStableParameterNames = CollectionsKt.any(superFunctions, CallableDescriptor::hasStableParameterNames);
return new ValueParameters(resultReceiverType, resultParameters, hasStableParameterNames);
}