public static Map<TypeParameterDescriptor, TypeParameterDescriptorImpl> recreateTypeParametersAndReturnMapping( @NotNull List<TypeParameterDescriptor> originalParameters, @Nullable DeclarationDescriptor newOwner) { // LinkedHashMap to save the order of type parameters Map<TypeParameterDescriptor, TypeParameterDescriptorImpl> result = new LinkedHashMap<TypeParameterDescriptor, TypeParameterDescriptorImpl>(); for (TypeParameterDescriptor typeParameter : originalParameters) { result.put( typeParameter, TypeParameterDescriptorImpl.createForFurtherModification( newOwner == null ? typeParameter.getContainingDeclaration() : newOwner, typeParameter.getAnnotations(), typeParameter.isReified(), typeParameter.getVariance(), typeParameter.getName(), typeParameter.getIndex(), SourceElement.NO_SOURCE)); } return result; }
private static boolean allParametersReified(KotlinType subtype) { for (TypeParameterDescriptor parameterDescriptor : subtype.getConstructor().getParameters()) { if (!parameterDescriptor.isReified()) return false; } return true; }
public static boolean isNonReifiedTypeParameter(@NotNull KotlinType type) { TypeParameterDescriptor typeParameterDescriptor = getTypeParameterDescriptorOrNull(type); return typeParameterDescriptor != null && !typeParameterDescriptor.isReified(); }