Drop package facades: code cleanup in Kotlin project.
This commit is contained in:
+1
-1
@@ -106,7 +106,7 @@ public class JavaConstructorDescriptor extends ConstructorDescriptorImpl impleme
|
||||
enhancedReceiverType,
|
||||
getDispatchReceiverParameter(),
|
||||
getTypeParameters(),
|
||||
DescriptorsPackage.copyValueParameters(enhancedValueParametersTypes, getValueParameters(), enhanced),
|
||||
UtilKt.copyValueParameters(enhancedValueParametersTypes, getValueParameters(), enhanced),
|
||||
enhancedReturnType,
|
||||
getModality(),
|
||||
getVisibility()
|
||||
|
||||
@@ -54,7 +54,7 @@ public abstract class KotlinBuiltIns {
|
||||
public static final Set<FqName> BUILT_INS_PACKAGE_FQ_NAMES = setOf(
|
||||
BUILT_INS_PACKAGE_FQ_NAME,
|
||||
ANNOTATION_PACKAGE_FQ_NAME,
|
||||
BuiltinsPackage.getKOTLIN_REFLECT_FQ_NAME()
|
||||
ReflectionTypesKt.getKOTLIN_REFLECT_FQ_NAME()
|
||||
);
|
||||
|
||||
protected final ModuleDescriptorImpl builtInsModule;
|
||||
@@ -73,7 +73,7 @@ public abstract class KotlinBuiltIns {
|
||||
Name.special("<built-ins module>"), storageManager, ModuleParameters.Empty.INSTANCE$, this
|
||||
);
|
||||
|
||||
PackageFragmentProvider packageFragmentProvider = BuiltinsPackage.createBuiltInPackageFragmentProvider(
|
||||
PackageFragmentProvider packageFragmentProvider = BuiltInsPackageFragmentProviderKt.createBuiltInPackageFragmentProvider(
|
||||
storageManager, builtInsModule, BUILT_INS_PACKAGE_FQ_NAMES,
|
||||
new BuiltInFictitiousFunctionClassFactory(storageManager, builtInsModule),
|
||||
getAdditionalSupertypesProvider(),
|
||||
|
||||
@@ -23,7 +23,7 @@ import org.jetbrains.kotlin.resolve.DescriptorUtils;
|
||||
import org.jetbrains.kotlin.resolve.scopes.receivers.ClassReceiver;
|
||||
import org.jetbrains.kotlin.resolve.scopes.receivers.ReceiverValue;
|
||||
import org.jetbrains.kotlin.util.ModuleVisibilityHelper;
|
||||
import org.jetbrains.kotlin.utils.UtilsPackage;
|
||||
import org.jetbrains.kotlin.utils.CollectionsKt;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@@ -227,7 +227,7 @@ public class Visibilities {
|
||||
private static final Map<Visibility, Integer> ORDERED_VISIBILITIES;
|
||||
|
||||
static {
|
||||
Map<Visibility, Integer> visibilities = UtilsPackage.newHashMapWithExpectedSize(4);
|
||||
Map<Visibility, Integer> visibilities = CollectionsKt.newHashMapWithExpectedSize(4);
|
||||
visibilities.put(PRIVATE_TO_THIS, 0);
|
||||
visibilities.put(PRIVATE, 0);
|
||||
visibilities.put(INTERNAL, 1);
|
||||
|
||||
+1
-1
@@ -36,7 +36,7 @@ import org.jetbrains.kotlin.types.checker.JetTypeChecker;
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
|
||||
import static org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilPackage.getBuiltIns;
|
||||
import static org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilsKt.getBuiltIns;
|
||||
|
||||
public abstract class AbstractTypeParameterDescriptor extends DeclarationDescriptorNonRootImpl implements TypeParameterDescriptor {
|
||||
private final Variance variance;
|
||||
|
||||
+2
-2
@@ -26,8 +26,8 @@ import org.jetbrains.kotlin.types.DescriptorSubstitutor;
|
||||
import org.jetbrains.kotlin.types.JetType;
|
||||
import org.jetbrains.kotlin.types.TypeSubstitutor;
|
||||
import org.jetbrains.kotlin.types.Variance;
|
||||
import org.jetbrains.kotlin.utils.CollectionsKt;
|
||||
import org.jetbrains.kotlin.utils.SmartSet;
|
||||
import org.jetbrains.kotlin.utils.UtilsPackage;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
@@ -71,7 +71,7 @@ public abstract class FunctionDescriptorImpl extends DeclarationDescriptorNonRoo
|
||||
@Nullable Modality modality,
|
||||
@NotNull Visibility visibility
|
||||
) {
|
||||
this.typeParameters = UtilsPackage.toReadOnlyList(typeParameters);
|
||||
this.typeParameters = CollectionsKt.toReadOnlyList(typeParameters);
|
||||
this.unsubstitutedValueParameters = unsubstitutedValueParameters;
|
||||
this.unsubstitutedReturnType = unsubstitutedReturnType;
|
||||
this.modality = modality;
|
||||
|
||||
+1
-1
@@ -31,7 +31,7 @@ import org.jetbrains.kotlin.utils.SmartSet;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import static org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilPackage.getBuiltIns;
|
||||
import static org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilsKt.getBuiltIns;
|
||||
|
||||
public class PropertyDescriptorImpl extends VariableDescriptorWithInitializerImpl implements PropertyDescriptor {
|
||||
private final Modality modality;
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@ import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import static org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilPackage.getBuiltIns;
|
||||
import static org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilsKt.getBuiltIns;
|
||||
|
||||
public class PropertySetterDescriptorImpl extends PropertyAccessorDescriptorImpl implements PropertySetterDescriptor {
|
||||
|
||||
|
||||
+1
-1
@@ -33,7 +33,7 @@ import org.jetbrains.kotlin.utils.SmartSet;
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
|
||||
import static org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilPackage.getBuiltIns;
|
||||
import static org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilsKt.getBuiltIns;
|
||||
|
||||
public class TypeParameterDescriptorImpl extends AbstractTypeParameterDescriptor {
|
||||
public static TypeParameterDescriptor createWithDefaultBound(
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
package org.jetbrains.kotlin.name;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.kotlin.utils.UtilsPackage;
|
||||
import org.jetbrains.kotlin.utils.StringsKt;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -26,7 +26,7 @@ public final class FqName extends FqNameBase {
|
||||
|
||||
@NotNull
|
||||
public static FqName fromSegments(@NotNull List<String> names) {
|
||||
return new FqName(UtilsPackage.join(names, "."));
|
||||
return new FqName(StringsKt.join(names, "."));
|
||||
}
|
||||
|
||||
public static final FqName ROOT = new FqName("");
|
||||
|
||||
@@ -18,7 +18,7 @@ package org.jetbrains.kotlin.name;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.kotlin.utils.UtilsPackage;
|
||||
import org.jetbrains.kotlin.utils.StringsKt;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -243,7 +243,7 @@ public final class FqNameUnsafe extends FqNameBase {
|
||||
|
||||
@NotNull
|
||||
public static FqNameUnsafe fromSegments(@NotNull List<?> names) {
|
||||
return new FqNameUnsafe(UtilsPackage.join(names, "."));
|
||||
return new FqNameUnsafe(StringsKt.join(names, "."));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ import org.jetbrains.kotlin.types.Variance;
|
||||
import java.util.Collections;
|
||||
|
||||
import static org.jetbrains.kotlin.resolve.DescriptorUtils.getDefaultConstructorVisibility;
|
||||
import static org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilPackage.getBuiltIns;
|
||||
import static org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilsKt.getBuiltIns;
|
||||
|
||||
public class DescriptorFactory {
|
||||
private static class DefaultConstructorDescriptor extends ConstructorDescriptorImpl {
|
||||
|
||||
@@ -47,7 +47,7 @@ import java.util.*;
|
||||
|
||||
import static org.jetbrains.kotlin.builtins.KotlinBuiltIns.isAny;
|
||||
import static org.jetbrains.kotlin.descriptors.CallableMemberDescriptor.Kind.*;
|
||||
import static org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilPackage.getBuiltIns;
|
||||
import static org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilsKt.getBuiltIns;
|
||||
|
||||
public class DescriptorUtils {
|
||||
public static final Name ENUM_VALUES = Name.identifier("values");
|
||||
|
||||
@@ -20,7 +20,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.kotlin.name.FqName;
|
||||
import org.jetbrains.kotlin.name.Name;
|
||||
import org.jetbrains.kotlin.renderer.RendererPackage;
|
||||
import org.jetbrains.kotlin.renderer.RenderingUtilsKt;
|
||||
|
||||
public final class ImportPath {
|
||||
private final @NotNull FqName fqName;
|
||||
@@ -51,7 +51,7 @@ public final class ImportPath {
|
||||
}
|
||||
|
||||
public String getPathStr() {
|
||||
return RendererPackage.render(fqName) + (isAllUnder ? ".*" : "");
|
||||
return RenderingUtilsKt.render(fqName) + (isAllUnder ? ".*" : "");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -28,7 +28,7 @@ import org.jetbrains.kotlin.descriptors.annotations.Annotations;
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilsKt;
|
||||
import org.jetbrains.kotlin.resolve.scopes.JetScope;
|
||||
import org.jetbrains.kotlin.types.checker.JetTypeChecker;
|
||||
import org.jetbrains.kotlin.types.typeUtil.TypeUtilPackage;
|
||||
import org.jetbrains.kotlin.types.typeUtil.TypeUtilsKt;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@@ -88,9 +88,9 @@ public class CommonSupertypes {
|
||||
List<JetType> lower = new ArrayList<JetType>(types.size());
|
||||
Set<FlexibleTypeCapabilities> capabilities = new LinkedHashSet<FlexibleTypeCapabilities>();
|
||||
for (JetType type : types) {
|
||||
if (TypesPackage.isFlexible(type)) {
|
||||
if (FlexibleTypesKt.isFlexible(type)) {
|
||||
hasFlexible = true;
|
||||
Flexibility flexibility = TypesPackage.flexibility(type);
|
||||
Flexibility flexibility = FlexibleTypesKt.flexibility(type);
|
||||
upper.add(flexibility.getUpperBound());
|
||||
lower.add(flexibility.getLowerBound());
|
||||
capabilities.add(flexibility.getExtraCapabilities());
|
||||
@@ -114,7 +114,7 @@ public class CommonSupertypes {
|
||||
assert !types.isEmpty();
|
||||
Collection<JetType> typeSet = new HashSet<JetType>(types);
|
||||
|
||||
JetType bestFit = TypesPackage.singleBestRepresentative(typeSet);
|
||||
JetType bestFit = FlexibleTypesKt.singleBestRepresentative(typeSet);
|
||||
if (bestFit != null) return bestFit;
|
||||
|
||||
// If any of the types is nullable, the result must be nullable
|
||||
@@ -123,7 +123,7 @@ public class CommonSupertypes {
|
||||
for (Iterator<JetType> iterator = typeSet.iterator(); iterator.hasNext();) {
|
||||
JetType type = iterator.next();
|
||||
assert type != null;
|
||||
assert !TypesPackage.isFlexible(type) : "Flexible type " + type + " passed to commonSuperTypeForInflexible";
|
||||
assert !FlexibleTypesKt.isFlexible(type) : "Flexible type " + type + " passed to commonSuperTypeForInflexible";
|
||||
if (KotlinBuiltIns.isNothingOrNullableNothing(type)) {
|
||||
iterator.remove();
|
||||
}
|
||||
@@ -249,7 +249,7 @@ public class CommonSupertypes {
|
||||
@NotNull Set<TypeProjection> typeProjections,
|
||||
int recursionDepth, int maxDepth
|
||||
) {
|
||||
TypeProjection singleBestProjection = TypesPackage.singleBestRepresentative(typeProjections);
|
||||
TypeProjection singleBestProjection = FlexibleTypesKt.singleBestRepresentative(typeProjections);
|
||||
if (singleBestProjection != null) {
|
||||
return singleBestProjection;
|
||||
}
|
||||
@@ -302,7 +302,7 @@ public class CommonSupertypes {
|
||||
Variance projectionKind = variance == OUT_VARIANCE ? Variance.INVARIANT : OUT_VARIANCE;
|
||||
JetType superType = findCommonSupertype(outs, recursionDepth + 1, maxDepth);
|
||||
for (JetType upperBound: parameterDescriptor.getUpperBounds()) {
|
||||
if (!TypeUtilPackage.isSubtypeOf(superType, upperBound)) {
|
||||
if (!TypeUtilsKt.isSubtypeOf(superType, upperBound)) {
|
||||
return new StarProjectionImpl(parameterDescriptor);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ import org.jetbrains.kotlin.types.checker.JetTypeChecker;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import static org.jetbrains.kotlin.resolve.calls.inference.InferencePackage.registerTypeVariables;
|
||||
import static org.jetbrains.kotlin.resolve.calls.inference.ConstraintSystemImplKt.registerTypeVariables;
|
||||
import static org.jetbrains.kotlin.resolve.calls.inference.constraintPosition.ConstraintPositionKind.SPECIAL;
|
||||
|
||||
public class TypeIntersector {
|
||||
@@ -114,7 +114,7 @@ public class TypeIntersector {
|
||||
// in that case, we can safely select the best representative out of that set and return it
|
||||
// TODO: maybe return the most specific among the types that are subtypes to all others in the `nullabilityStripped`?
|
||||
// TODO: e.g. among {Int, Int?, Int!}, return `Int` (now it returns `Int!`).
|
||||
JetType bestRepresentative = TypesPackage.singleBestRepresentative(nullabilityStripped);
|
||||
JetType bestRepresentative = FlexibleTypesKt.singleBestRepresentative(nullabilityStripped);
|
||||
if (bestRepresentative == null) {
|
||||
throw new AssertionError("Empty intersection for types " + types);
|
||||
}
|
||||
@@ -183,7 +183,7 @@ public class TypeIntersector {
|
||||
}
|
||||
parameters.put(parameterUsage.typeParameterDescriptor,
|
||||
parameterUsage.howTheTypeParameterIsUsed.superpose(howTheTypeIsUsedBefore));
|
||||
return Unit.INSTANCE$;
|
||||
return Unit.INSTANCE;
|
||||
}
|
||||
};
|
||||
processAllTypeParameters(withParameters, Variance.INVARIANT, processor);
|
||||
|
||||
@@ -25,10 +25,10 @@ import org.jetbrains.kotlin.descriptors.annotations.Annotations;
|
||||
import org.jetbrains.kotlin.descriptors.annotations.CompositeAnnotations;
|
||||
import org.jetbrains.kotlin.descriptors.annotations.FilteredAnnotations;
|
||||
import org.jetbrains.kotlin.name.FqName;
|
||||
import org.jetbrains.kotlin.resolve.calls.inference.InferencePackage;
|
||||
import org.jetbrains.kotlin.resolve.calls.inference.CapturedTypeConstructorKt;
|
||||
import org.jetbrains.kotlin.resolve.scopes.SubstitutingScope;
|
||||
import org.jetbrains.kotlin.types.typeUtil.TypeUtilPackage;
|
||||
import org.jetbrains.kotlin.types.typesApproximation.TypesApproximationPackage;
|
||||
import org.jetbrains.kotlin.types.typeUtil.TypeUtilsKt;
|
||||
import org.jetbrains.kotlin.types.typesApproximation.CapturedTypeApproximationKt;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@@ -106,7 +106,7 @@ public class TypeSubstitutor {
|
||||
if (!substitution.approximateCapturedTypes()) {
|
||||
return substitutedTypeProjection;
|
||||
}
|
||||
return TypesApproximationPackage.approximateCapturedTypesIfNecessary(substitutedTypeProjection);
|
||||
return CapturedTypeApproximationKt.approximateCapturedTypesIfNecessary(substitutedTypeProjection);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -132,8 +132,8 @@ public class TypeSubstitutor {
|
||||
JetType type = originalProjection.getType();
|
||||
TypeProjection replacement = substitution.get(type);
|
||||
Variance originalProjectionKind = originalProjection.getProjectionKind();
|
||||
if (replacement == null && TypesPackage.isFlexible(type) && !TypesPackage.isCustomTypeVariable(type)) {
|
||||
Flexibility flexibility = TypesPackage.flexibility(type);
|
||||
if (replacement == null && FlexibleTypesKt.isFlexible(type) && !TypeCapabilitiesKt.isCustomTypeVariable(type)) {
|
||||
Flexibility flexibility = FlexibleTypesKt.flexibility(type);
|
||||
TypeProjection substitutedLower =
|
||||
unsafeSubstitute(new TypeProjectionImpl(originalProjectionKind, flexibility.getLowerBound()), recursionDepth + 1);
|
||||
TypeProjection substitutedUpper =
|
||||
@@ -157,7 +157,7 @@ public class TypeSubstitutor {
|
||||
// Captured type might be substituted in an opposite projection:
|
||||
// out 'Captured (in Int)' = out Int
|
||||
// in 'Captured (out Int)' = in Int
|
||||
boolean allowVarianceConflict = InferencePackage.isCaptured(type);
|
||||
boolean allowVarianceConflict = CapturedTypeConstructorKt.isCaptured(type);
|
||||
if (!allowVarianceConflict) {
|
||||
//noinspection EnumSwitchStatementWhichMissesCases
|
||||
switch (varianceConflict) {
|
||||
@@ -169,7 +169,7 @@ public class TypeSubstitutor {
|
||||
}
|
||||
}
|
||||
JetType substitutedType;
|
||||
CustomTypeVariable typeVariable = TypesPackage.getCustomTypeVariable(type);
|
||||
CustomTypeVariable typeVariable = TypeCapabilitiesKt.getCustomTypeVariable(type);
|
||||
if (replacement.isStarProjection()) {
|
||||
return replacement;
|
||||
}
|
||||
@@ -184,7 +184,7 @@ public class TypeSubstitutor {
|
||||
// substitutionType.annotations = replacement.annotations ++ type.annotations
|
||||
if (!type.getAnnotations().isEmpty()) {
|
||||
Annotations typeAnnotations = filterOutUnsafeVariance(type.getAnnotations());
|
||||
substitutedType = TypeUtilPackage.replaceAnnotations(
|
||||
substitutedType = TypeUtilsKt.replaceAnnotations(
|
||||
substitutedType,
|
||||
new CompositeAnnotations(substitutedType.getAnnotations(), typeAnnotations)
|
||||
);
|
||||
@@ -229,7 +229,7 @@ public class TypeSubstitutor {
|
||||
// e.g. for return type Foo of 'add(..)' in 'class Foo { fun <R> add(bar: Bar<R>): Foo }' R shouldn't be substituted in the scope
|
||||
TypeSubstitution substitutionFilteringTypeParameters = new TypeSubstitution() {
|
||||
private final Collection<TypeConstructor> containedOrCapturedTypeParameters =
|
||||
TypeUtilPackage.getContainedAndCapturedTypeParameterConstructors(type);
|
||||
TypeUtilsKt.getContainedAndCapturedTypeParameterConstructors(type);
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
|
||||
@@ -29,7 +29,6 @@ import org.jetbrains.kotlin.resolve.constants.IntegerValueTypeConstructor;
|
||||
import org.jetbrains.kotlin.resolve.scopes.JetScope;
|
||||
import org.jetbrains.kotlin.types.checker.JetTypeChecker;
|
||||
import org.jetbrains.kotlin.utils.DFS;
|
||||
import org.jetbrains.kotlin.utils.UtilsPackage;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@@ -95,7 +94,7 @@ public class TypeUtils {
|
||||
@NotNull
|
||||
@Override
|
||||
public TypeCapabilities getCapabilities() {
|
||||
return TypeCapabilities.NONE.INSTANCE$;
|
||||
return TypeCapabilities.NONE.INSTANCE;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -257,7 +256,7 @@ public class TypeUtils {
|
||||
for (TypeParameterDescriptor parameterDescriptor : parameters) {
|
||||
result.add(new TypeProjectionImpl(parameterDescriptor.getDefaultType()));
|
||||
}
|
||||
return UtilsPackage.toReadOnlyList(result);
|
||||
return org.jetbrains.kotlin.utils.CollectionsKt.toReadOnlyList(result);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -311,7 +310,7 @@ public class TypeUtils {
|
||||
if (type.isMarkedNullable()) {
|
||||
return true;
|
||||
}
|
||||
if (TypesPackage.isFlexible(type) && isNullableType(TypesPackage.flexibility(type).getUpperBound())) {
|
||||
if (FlexibleTypesKt.isFlexible(type) && isNullableType(FlexibleTypesKt.flexibility(type).getUpperBound())) {
|
||||
return true;
|
||||
}
|
||||
if (isTypeParameter(type)) {
|
||||
@@ -329,7 +328,7 @@ public class TypeUtils {
|
||||
if (type.isMarkedNullable()) {
|
||||
return true;
|
||||
}
|
||||
if (TypesPackage.isFlexible(type) && acceptsNullable(TypesPackage.flexibility(type).getUpperBound())) {
|
||||
if (FlexibleTypesKt.isFlexible(type) && acceptsNullable(FlexibleTypesKt.flexibility(type).getUpperBound())) {
|
||||
return true;
|
||||
}
|
||||
if (isTypeParameter(type)) {
|
||||
@@ -380,7 +379,8 @@ public class TypeUtils {
|
||||
throw new IllegalArgumentException("type parameter counts do not match: " + clazz + ", " + projections);
|
||||
}
|
||||
|
||||
Map<TypeConstructor, TypeProjection> substitutions = UtilsPackage.newHashMapWithExpectedSize(clazzTypeParameters.size());
|
||||
Map<TypeConstructor, TypeProjection> substitutions = org.jetbrains.kotlin.utils.CollectionsKt
|
||||
.newHashMapWithExpectedSize(clazzTypeParameters.size());
|
||||
|
||||
for (int i = 0; i < clazzTypeParameters.size(); ++i) {
|
||||
TypeConstructor typeConstructor = clazzTypeParameters.get(i).getTypeConstructor();
|
||||
@@ -572,7 +572,8 @@ public class TypeUtils {
|
||||
}
|
||||
|
||||
public static TypeSubstitutor makeConstantSubstitutor(Collection<TypeParameterDescriptor> typeParameterDescriptors, JetType type) {
|
||||
final Set<TypeConstructor> constructors = UtilsPackage.newHashSetWithExpectedSize(typeParameterDescriptors.size());
|
||||
final Set<TypeConstructor> constructors = org.jetbrains.kotlin.utils.CollectionsKt
|
||||
.newHashSetWithExpectedSize(typeParameterDescriptors.size());
|
||||
for (TypeParameterDescriptor typeParameterDescriptor : typeParameterDescriptors) {
|
||||
constructors.add(typeParameterDescriptor.getTypeConstructor());
|
||||
}
|
||||
|
||||
+12
-12
@@ -20,11 +20,11 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.kotlin.builtins.KotlinBuiltIns;
|
||||
import org.jetbrains.kotlin.descriptors.TypeParameterDescriptor;
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilsKt;
|
||||
import org.jetbrains.kotlin.types.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilPackage.getBuiltIns;
|
||||
import static org.jetbrains.kotlin.types.Variance.*;
|
||||
|
||||
public class TypeCheckingProcedure {
|
||||
@@ -40,7 +40,7 @@ public class TypeCheckingProcedure {
|
||||
// as the second parameter, applying the substitution of type arguments to it
|
||||
@Nullable
|
||||
public static JetType findCorrespondingSupertype(@NotNull JetType subtype, @NotNull JetType supertype, @NotNull TypeCheckingProcedureCallbacks typeCheckingProcedureCallbacks) {
|
||||
return CheckerPackage.findCorrespondingSupertype(subtype, supertype, typeCheckingProcedureCallbacks);
|
||||
return UtilsKt.findCorrespondingSupertype(subtype, supertype, typeCheckingProcedureCallbacks);
|
||||
}
|
||||
|
||||
public static JetType getOutType(TypeParameterDescriptor parameter, TypeProjection argument) {
|
||||
@@ -50,7 +50,7 @@ public class TypeCheckingProcedure {
|
||||
|
||||
public static JetType getInType(@NotNull TypeParameterDescriptor parameter, @NotNull TypeProjection argument) {
|
||||
boolean isOutProjected = argument.getProjectionKind() == OUT_VARIANCE || parameter.getVariance() == OUT_VARIANCE;
|
||||
return isOutProjected ? getBuiltIns(parameter).getNothingType() : argument.getType();
|
||||
return isOutProjected ? DescriptorUtilsKt.getBuiltIns(parameter).getNothingType() : argument.getType();
|
||||
}
|
||||
|
||||
private final TypeCheckingProcedureCallbacks constraints;
|
||||
@@ -61,13 +61,13 @@ public class TypeCheckingProcedure {
|
||||
|
||||
public boolean equalTypes(@NotNull JetType type1, @NotNull JetType type2) {
|
||||
if (type1 == type2) return true;
|
||||
if (TypesPackage.isFlexible(type1)) {
|
||||
if (TypesPackage.isFlexible(type2)) {
|
||||
if (FlexibleTypesKt.isFlexible(type1)) {
|
||||
if (FlexibleTypesKt.isFlexible(type2)) {
|
||||
return !type1.isError() && !type2.isError() && isSubtypeOf(type1, type2) && isSubtypeOf(type2, type1);
|
||||
}
|
||||
return heterogeneousEquivalence(type2, type1);
|
||||
}
|
||||
else if (TypesPackage.isFlexible(type2)) {
|
||||
else if (FlexibleTypesKt.isFlexible(type2)) {
|
||||
return heterogeneousEquivalence(type1, type2);
|
||||
}
|
||||
|
||||
@@ -118,9 +118,9 @@ public class TypeCheckingProcedure {
|
||||
|
||||
protected boolean heterogeneousEquivalence(JetType inflexibleType, JetType flexibleType) {
|
||||
// This is to account for the case when we have Collection<X> vs (Mutable)Collection<X>! or K(java.util.Collection<? extends X>)
|
||||
assert !TypesPackage.isFlexible(inflexibleType) : "Only inflexible types are allowed here: " + inflexibleType;
|
||||
return isSubtypeOf(TypesPackage.flexibility(flexibleType).getLowerBound(), inflexibleType)
|
||||
&& isSubtypeOf(inflexibleType, TypesPackage.flexibility(flexibleType).getUpperBound());
|
||||
assert !FlexibleTypesKt.isFlexible(inflexibleType) : "Only inflexible types are allowed here: " + inflexibleType;
|
||||
return isSubtypeOf(FlexibleTypesKt.flexibility(flexibleType).getLowerBound(), inflexibleType)
|
||||
&& isSubtypeOf(inflexibleType, FlexibleTypesKt.flexibility(flexibleType).getUpperBound());
|
||||
}
|
||||
|
||||
public enum EnrichedProjectionKind {
|
||||
@@ -179,11 +179,11 @@ public class TypeCheckingProcedure {
|
||||
}
|
||||
|
||||
public boolean isSubtypeOf(@NotNull JetType subtype, @NotNull JetType supertype) {
|
||||
if (TypesPackage.sameTypeConstructors(subtype, supertype)) {
|
||||
if (TypeCapabilitiesKt.sameTypeConstructors(subtype, supertype)) {
|
||||
return !subtype.isMarkedNullable() || supertype.isMarkedNullable();
|
||||
}
|
||||
JetType subtypeRepresentative = TypesPackage.getSubtypeRepresentative(subtype);
|
||||
JetType supertypeRepresentative = TypesPackage.getSupertypeRepresentative(supertype);
|
||||
JetType subtypeRepresentative = TypeCapabilitiesKt.getSubtypeRepresentative(subtype);
|
||||
JetType supertypeRepresentative = TypeCapabilitiesKt.getSupertypeRepresentative(supertype);
|
||||
if (subtypeRepresentative != subtype || supertypeRepresentative != supertype) {
|
||||
// recursive invocation for possible chain of representatives
|
||||
return isSubtypeOf(subtypeRepresentative, supertypeRepresentative);
|
||||
|
||||
+2
-2
@@ -21,7 +21,7 @@ import org.jetbrains.kotlin.name.ClassId;
|
||||
import org.jetbrains.kotlin.name.FqName;
|
||||
import org.jetbrains.kotlin.name.Name;
|
||||
import org.jetbrains.kotlin.serialization.ProtoBuf;
|
||||
import org.jetbrains.kotlin.utils.UtilsPackage;
|
||||
import org.jetbrains.kotlin.utils.ExceptionUtilsKt;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
@@ -38,7 +38,7 @@ public class NameResolverImpl implements NameResolver {
|
||||
return new NameResolverImpl(simpleNames, qualifiedNames);
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw UtilsPackage.rethrow(e);
|
||||
throw ExceptionUtilsKt.rethrow(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-2
@@ -23,7 +23,6 @@ import org.jetbrains.kotlin.descriptors.impl.AbstractLazyTypeParameterDescriptor
|
||||
import org.jetbrains.kotlin.serialization.ProtoBuf;
|
||||
import org.jetbrains.kotlin.serialization.deserialization.Deserialization;
|
||||
import org.jetbrains.kotlin.serialization.deserialization.DeserializationContext;
|
||||
import org.jetbrains.kotlin.serialization.deserialization.DeserializationPackage;
|
||||
import org.jetbrains.kotlin.serialization.deserialization.TypeDeserializer;
|
||||
import org.jetbrains.kotlin.types.JetType;
|
||||
|
||||
@@ -31,7 +30,7 @@ import java.util.Collections;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import static org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilPackage.getBuiltIns;
|
||||
import static org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilsKt.getBuiltIns;
|
||||
|
||||
public class DeserializedTypeParameterDescriptor extends AbstractLazyTypeParameterDescriptor {
|
||||
private final ProtoBuf.TypeParameter proto;
|
||||
|
||||
@@ -36,7 +36,7 @@ public class ReflectionFactoryImpl extends ReflectionFactory {
|
||||
|
||||
@Override
|
||||
public KClass getOrCreateKotlinClass(Class javaClass) {
|
||||
return InternalPackage.getOrCreateKotlinClass(javaClass);
|
||||
return KClassCacheKt.getOrCreateKotlinClass(javaClass);
|
||||
}
|
||||
|
||||
// Functions
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package kotlin.reflect.jvm.internal
|
||||
|
||||
import java.lang.ref.WeakReference
|
||||
import kotlin.reflect.KClass
|
||||
import kotlin.reflect.jvm.internal.pcollections.HashPMap
|
||||
|
||||
// TODO: collect nulls periodically
|
||||
|
||||
@@ -21,7 +21,7 @@ import kotlin.jvm.functions.Function0;
|
||||
import kotlin.jvm.functions.Function1;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.kotlin.utils.UtilsPackage;
|
||||
import org.jetbrains.kotlin.utils.ExceptionUtilsKt;
|
||||
import org.jetbrains.kotlin.utils.WrappedValues;
|
||||
|
||||
import java.util.Arrays;
|
||||
@@ -37,7 +37,7 @@ public class LockBasedStorageManager implements StorageManager {
|
||||
@NotNull
|
||||
@Override
|
||||
public RuntimeException handleException(@NotNull Throwable throwable) {
|
||||
throw UtilsPackage.rethrow(throwable);
|
||||
throw ExceptionUtilsKt.rethrow(throwable);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -74,7 +74,7 @@ public class WrappedValues {
|
||||
@Nullable
|
||||
public static <V> V unescapeThrowable(@Nullable Object value) {
|
||||
if (value instanceof ThrowableWrapper) {
|
||||
throw UtilsPackage.rethrow(((ThrowableWrapper) value).getThrowable());
|
||||
throw ExceptionUtilsKt.rethrow(((ThrowableWrapper) value).getThrowable());
|
||||
}
|
||||
|
||||
//noinspection unchecked
|
||||
|
||||
Reference in New Issue
Block a user