Minor, get rid of AlternativeMethodSignature in irrelevant place
This commit is contained in:
+2
-2
@@ -60,7 +60,7 @@ public interface ExternalSignatureResolver {
|
|||||||
private final boolean hasStableParameterNames;
|
private final boolean hasStableParameterNames;
|
||||||
|
|
||||||
public AlternativeMethodSignature(
|
public AlternativeMethodSignature(
|
||||||
@Nullable KotlinType returnType,
|
@NotNull KotlinType returnType,
|
||||||
@Nullable KotlinType receiverType,
|
@Nullable KotlinType receiverType,
|
||||||
@NotNull List<ValueParameterDescriptor> valueParameters,
|
@NotNull List<ValueParameterDescriptor> valueParameters,
|
||||||
@NotNull List<TypeParameterDescriptor> typeParameters,
|
@NotNull List<TypeParameterDescriptor> typeParameters,
|
||||||
@@ -75,7 +75,7 @@ public interface ExternalSignatureResolver {
|
|||||||
this.hasStableParameterNames = hasStableParameterNames;
|
this.hasStableParameterNames = hasStableParameterNames;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@NotNull
|
||||||
public KotlinType getReturnType() {
|
public KotlinType getReturnType() {
|
||||||
return returnType;
|
return returnType;
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-4
@@ -30,7 +30,6 @@ import org.jetbrains.kotlin.load.java.BuiltinMethodsWithDifferentJvmName.sameAsR
|
|||||||
import org.jetbrains.kotlin.load.java.BuiltinMethodsWithSpecialGenericSignature.sameAsBuiltinMethodWithErasedValueParameters
|
import org.jetbrains.kotlin.load.java.BuiltinMethodsWithSpecialGenericSignature.sameAsBuiltinMethodWithErasedValueParameters
|
||||||
import org.jetbrains.kotlin.load.java.BuiltinSpecialProperties.getBuiltinSpecialPropertyGetterName
|
import org.jetbrains.kotlin.load.java.BuiltinSpecialProperties.getBuiltinSpecialPropertyGetterName
|
||||||
import org.jetbrains.kotlin.load.java.components.DescriptorResolverUtils
|
import org.jetbrains.kotlin.load.java.components.DescriptorResolverUtils
|
||||||
import org.jetbrains.kotlin.load.java.components.ExternalSignatureResolver
|
|
||||||
import org.jetbrains.kotlin.load.java.components.TypeUsage
|
import org.jetbrains.kotlin.load.java.components.TypeUsage
|
||||||
import org.jetbrains.kotlin.load.java.descriptors.JavaConstructorDescriptor
|
import org.jetbrains.kotlin.load.java.descriptors.JavaConstructorDescriptor
|
||||||
import org.jetbrains.kotlin.load.java.descriptors.JavaMethodDescriptor
|
import org.jetbrains.kotlin.load.java.descriptors.JavaMethodDescriptor
|
||||||
@@ -421,12 +420,15 @@ public class LazyJavaClassMemberScope(
|
|||||||
|
|
||||||
override fun resolveMethodSignature(
|
override fun resolveMethodSignature(
|
||||||
method: JavaMethod, methodTypeParameters: List<TypeParameterDescriptor>, returnType: KotlinType,
|
method: JavaMethod, methodTypeParameters: List<TypeParameterDescriptor>, returnType: KotlinType,
|
||||||
valueParameters: LazyJavaScope.ResolvedValueParameters
|
valueParameters: List<ValueParameterDescriptor>
|
||||||
): LazyJavaScope.MethodSignatureData {
|
): LazyJavaScope.MethodSignatureData {
|
||||||
val propagated = c.components.externalSignatureResolver.resolvePropagatedSignature(
|
val propagated = c.components.externalSignatureResolver.resolvePropagatedSignature(
|
||||||
method, ownerDescriptor, returnType, null, valueParameters.descriptors, methodTypeParameters
|
method, ownerDescriptor, returnType, null, valueParameters, methodTypeParameters
|
||||||
|
)
|
||||||
|
return LazyJavaScope.MethodSignatureData(
|
||||||
|
propagated.returnType, propagated.receiverType, propagated.valueParameters, propagated.typeParameters,
|
||||||
|
propagated.hasStableParameterNames(), propagated.errors
|
||||||
)
|
)
|
||||||
return LazyJavaScope.MethodSignatureData(propagated, propagated.errors)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun hasOverriddenBuiltinFunctionWithErasedValueParameters(
|
private fun hasOverriddenBuiltinFunctionWithErasedValueParameters(
|
||||||
|
|||||||
+15
-11
@@ -23,7 +23,6 @@ import org.jetbrains.kotlin.descriptors.impl.ValueParameterDescriptorImpl
|
|||||||
import org.jetbrains.kotlin.incremental.components.LookupLocation
|
import org.jetbrains.kotlin.incremental.components.LookupLocation
|
||||||
import org.jetbrains.kotlin.incremental.components.NoLookupLocation
|
import org.jetbrains.kotlin.incremental.components.NoLookupLocation
|
||||||
import org.jetbrains.kotlin.incremental.record
|
import org.jetbrains.kotlin.incremental.record
|
||||||
import org.jetbrains.kotlin.load.java.components.ExternalSignatureResolver
|
|
||||||
import org.jetbrains.kotlin.load.java.components.TypeUsage
|
import org.jetbrains.kotlin.load.java.components.TypeUsage
|
||||||
import org.jetbrains.kotlin.load.java.descriptors.JavaMethodDescriptor
|
import org.jetbrains.kotlin.load.java.descriptors.JavaMethodDescriptor
|
||||||
import org.jetbrains.kotlin.load.java.descriptors.JavaPropertyDescriptor
|
import org.jetbrains.kotlin.load.java.descriptors.JavaPropertyDescriptor
|
||||||
@@ -97,7 +96,11 @@ public abstract class LazyJavaScope(protected val c: LazyJavaResolverContext) :
|
|||||||
open protected fun JavaMethodDescriptor.isVisibleAsFunction() = true
|
open protected fun JavaMethodDescriptor.isVisibleAsFunction() = true
|
||||||
|
|
||||||
protected data class MethodSignatureData(
|
protected data class MethodSignatureData(
|
||||||
val effectiveSignature: ExternalSignatureResolver.AlternativeMethodSignature,
|
val returnType: KotlinType,
|
||||||
|
val receiverType: KotlinType?,
|
||||||
|
val valueParameters: List<ValueParameterDescriptor>,
|
||||||
|
val typeParameters: List<TypeParameterDescriptor>,
|
||||||
|
val hasStableParameterNames: Boolean,
|
||||||
val errors: List<String>
|
val errors: List<String>
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -105,7 +108,8 @@ public abstract class LazyJavaScope(protected val c: LazyJavaResolverContext) :
|
|||||||
method: JavaMethod,
|
method: JavaMethod,
|
||||||
methodTypeParameters: List<TypeParameterDescriptor>,
|
methodTypeParameters: List<TypeParameterDescriptor>,
|
||||||
returnType: KotlinType,
|
returnType: KotlinType,
|
||||||
valueParameters: ResolvedValueParameters): MethodSignatureData
|
valueParameters: List<ValueParameterDescriptor>
|
||||||
|
): MethodSignatureData
|
||||||
|
|
||||||
fun resolveMethodToFunctionDescriptor(method: JavaMethod): JavaMethodDescriptor {
|
fun resolveMethodToFunctionDescriptor(method: JavaMethod): JavaMethodDescriptor {
|
||||||
val annotations = c.resolveAnnotations(method)
|
val annotations = c.resolveAnnotations(method)
|
||||||
@@ -120,22 +124,22 @@ public abstract class LazyJavaScope(protected val c: LazyJavaResolverContext) :
|
|||||||
|
|
||||||
val returnType = computeMethodReturnType(method, annotations, c)
|
val returnType = computeMethodReturnType(method, annotations, c)
|
||||||
|
|
||||||
val (effectiveSignature, signatureErrors) = resolveMethodSignature(method, methodTypeParameters, returnType, valueParameters)
|
val effectiveSignature = resolveMethodSignature(method, methodTypeParameters, returnType, valueParameters.descriptors)
|
||||||
|
|
||||||
functionDescriptorImpl.initialize(
|
functionDescriptorImpl.initialize(
|
||||||
effectiveSignature.getReceiverType(),
|
effectiveSignature.receiverType,
|
||||||
getDispatchReceiverParameter(),
|
getDispatchReceiverParameter(),
|
||||||
effectiveSignature.getTypeParameters(),
|
effectiveSignature.typeParameters,
|
||||||
effectiveSignature.getValueParameters(),
|
effectiveSignature.valueParameters,
|
||||||
effectiveSignature.getReturnType(),
|
effectiveSignature.returnType,
|
||||||
Modality.convertFromFlags(method.isAbstract(), !method.isFinal()),
|
Modality.convertFromFlags(method.isAbstract(), !method.isFinal()),
|
||||||
method.getVisibility()
|
method.getVisibility()
|
||||||
)
|
)
|
||||||
|
|
||||||
functionDescriptorImpl.setParameterNamesStatus(effectiveSignature.hasStableParameterNames(), valueParameters.hasSynthesizedNames)
|
functionDescriptorImpl.setParameterNamesStatus(effectiveSignature.hasStableParameterNames, valueParameters.hasSynthesizedNames)
|
||||||
|
|
||||||
if (signatureErrors.isNotEmpty()) {
|
if (effectiveSignature.errors.isNotEmpty()) {
|
||||||
c.components.externalSignatureResolver.reportSignatureErrors(functionDescriptorImpl, signatureErrors)
|
c.components.externalSignatureResolver.reportSignatureErrors(functionDescriptorImpl, effectiveSignature.errors)
|
||||||
}
|
}
|
||||||
|
|
||||||
return functionDescriptorImpl
|
return functionDescriptorImpl
|
||||||
|
|||||||
+4
-8
@@ -18,7 +18,7 @@ package org.jetbrains.kotlin.load.java.lazy.descriptors
|
|||||||
|
|
||||||
import org.jetbrains.kotlin.descriptors.PropertyDescriptor
|
import org.jetbrains.kotlin.descriptors.PropertyDescriptor
|
||||||
import org.jetbrains.kotlin.descriptors.TypeParameterDescriptor
|
import org.jetbrains.kotlin.descriptors.TypeParameterDescriptor
|
||||||
import org.jetbrains.kotlin.load.java.components.ExternalSignatureResolver
|
import org.jetbrains.kotlin.descriptors.ValueParameterDescriptor
|
||||||
import org.jetbrains.kotlin.load.java.lazy.LazyJavaResolverContext
|
import org.jetbrains.kotlin.load.java.lazy.LazyJavaResolverContext
|
||||||
import org.jetbrains.kotlin.load.java.structure.JavaMethod
|
import org.jetbrains.kotlin.load.java.structure.JavaMethod
|
||||||
import org.jetbrains.kotlin.name.FqName
|
import org.jetbrains.kotlin.name.FqName
|
||||||
@@ -31,17 +31,13 @@ public abstract class LazyJavaStaticScope(c: LazyJavaResolverContext) : LazyJava
|
|||||||
|
|
||||||
// Package fragments are not nested
|
// Package fragments are not nested
|
||||||
override fun getPackage(name: Name) = null
|
override fun getPackage(name: Name) = null
|
||||||
|
|
||||||
abstract fun getSubPackages(): Collection<FqName>
|
abstract fun getSubPackages(): Collection<FqName>
|
||||||
|
|
||||||
override fun resolveMethodSignature(
|
override fun resolveMethodSignature(
|
||||||
method: JavaMethod, methodTypeParameters: List<TypeParameterDescriptor>, returnType: KotlinType,
|
method: JavaMethod, methodTypeParameters: List<TypeParameterDescriptor>, returnType: KotlinType,
|
||||||
valueParameters: LazyJavaScope.ResolvedValueParameters
|
valueParameters: List<ValueParameterDescriptor>
|
||||||
): LazyJavaScope.MethodSignatureData {
|
) = LazyJavaScope.MethodSignatureData(returnType, null, valueParameters, methodTypeParameters, false, emptyList())
|
||||||
val effectiveSignature = ExternalSignatureResolver.AlternativeMethodSignature(
|
|
||||||
returnType, null, valueParameters.descriptors, methodTypeParameters, emptyList<String>(), false
|
|
||||||
)
|
|
||||||
return LazyJavaScope.MethodSignatureData(effectiveSignature, effectiveSignature.getErrors())
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun computeNonDeclaredProperties(name: Name, result: MutableCollection<PropertyDescriptor>) {
|
override fun computeNonDeclaredProperties(name: Name, result: MutableCollection<PropertyDescriptor>) {
|
||||||
//no undeclared properties
|
//no undeclared properties
|
||||||
|
|||||||
Reference in New Issue
Block a user