MemberMatching: drop usage of KotlinBuiltIns.getInstance()
This commit is contained in:
@@ -376,9 +376,19 @@ public class KotlinBuiltIns {
|
||||
return getBuiltInClassByName("Unit");
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static String getFunctionName(int parameterCount) {
|
||||
return "Function" + parameterCount;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static String getExtensionFunctionName(int parameterCount) {
|
||||
return getFunctionName(parameterCount + 1);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public ClassDescriptor getFunction(int parameterCount) {
|
||||
return getBuiltInClassByName("Function" + parameterCount);
|
||||
return getBuiltInClassByName(getFunctionName(parameterCount));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -388,7 +398,7 @@ public class KotlinBuiltIns {
|
||||
@Deprecated
|
||||
@NotNull
|
||||
public ClassDescriptor getExtensionFunction(int parameterCount) {
|
||||
return getBuiltInClassByName("Function" + (parameterCount + 1));
|
||||
return getBuiltInClassByName(getExtensionFunctionName((parameterCount)));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
+6
-6
@@ -32,6 +32,7 @@ import org.jetbrains.kotlin.lexer.JetTokens;
|
||||
import org.jetbrains.kotlin.name.Name;
|
||||
import org.jetbrains.kotlin.psi.*;
|
||||
import org.jetbrains.kotlin.renderer.DescriptorRenderer;
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilsKt;
|
||||
import org.jetbrains.kotlin.types.JetType;
|
||||
|
||||
import java.util.List;
|
||||
@@ -73,14 +74,12 @@ public class MemberMatching {
|
||||
|
||||
@Override
|
||||
public String visitFunctionType(@NotNull JetFunctionType type, Void data) {
|
||||
KotlinBuiltIns builtIns = KotlinBuiltIns.getInstance();
|
||||
int parameterCount = type.getParameters().size();
|
||||
|
||||
if (type.getReceiverTypeReference() == null) {
|
||||
return builtIns.getFunction(parameterCount).getName().asString();
|
||||
if (type.getReceiverTypeReference() != null) {
|
||||
return KotlinBuiltIns.getExtensionFunctionName(parameterCount);
|
||||
}
|
||||
else {
|
||||
return builtIns.getExtensionFunction(parameterCount).getName().asString();
|
||||
return KotlinBuiltIns.getFunctionName(parameterCount);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -229,8 +228,9 @@ public class MemberMatching {
|
||||
}
|
||||
}));
|
||||
|
||||
KotlinBuiltIns builtIns = DescriptorUtilsKt.getBuiltIns(descriptor);
|
||||
Set<String> decompiledUpperBounds = decompiledParameterToBounds.get(descriptor.getName()).isEmpty()
|
||||
? Sets.newHashSet(DescriptorRenderer.FQ_NAMES_IN_TYPES.renderType(KotlinBuiltIns.getInstance().getDefaultBound()))
|
||||
? Sets.newHashSet(DescriptorRenderer.FQ_NAMES_IN_TYPES.renderType(builtIns.getDefaultBound()))
|
||||
: Sets.newHashSet(decompiledParameterToBounds.get(descriptor.getName()));
|
||||
if (!descriptorUpperBounds.equals(decompiledUpperBounds)) {
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user