private TypeParameterDescriptor createTypeVariable(String name) { return TypeParameterDescriptorImpl.createWithDefaultBound( builtIns.getBuiltInsModule(), Annotations.Companion.getEMPTY(), false, Variance.INVARIANT, Name.identifier(name), 0); }
public static TypeParameterDescriptor createWithDefaultBound( @NotNull DeclarationDescriptor containingDeclaration, @NotNull Annotations annotations, boolean reified, @NotNull Variance variance, @NotNull Name name, int index) { TypeParameterDescriptorImpl typeParameterDescriptor = createForFurtherModification( containingDeclaration, annotations, reified, variance, name, index, SourceElement.NO_SOURCE); typeParameterDescriptor.addUpperBound(getBuiltIns(containingDeclaration).getDefaultBound()); typeParameterDescriptor.setInitialized(); return typeParameterDescriptor; }
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; }