// Note: headers of member classes' members are not resolved public void resolveMemberHeaders() { ForceResolveUtil.forceResolveAllContents(getAnnotations()); ForceResolveUtil.forceResolveAllContents(getDanglingAnnotations()); getCompanionObjectDescriptor(); getDescriptorsForExtraCompanionObjects(); getConstructors(); getContainingDeclaration(); getThisAsReceiverParameter(); getKind(); getModality(); getName(); getOriginal(); getScopeForClassHeaderResolution(); getScopeForMemberDeclarationResolution(); DescriptorUtils.getAllDescriptors(getUnsubstitutedMemberScope()); getScopeForInitializerResolution(); getUnsubstitutedInnerClassesScope(); getTypeConstructor().getSupertypes(); for (TypeParameterDescriptor typeParameterDescriptor : getTypeConstructor().getParameters()) { typeParameterDescriptor.getUpperBounds(); } getUnsubstitutedPrimaryConstructor(); getVisibility(); }
private static boolean lowerThanBound( KotlinTypeChecker typeChecker, KotlinType argument, TypeParameterDescriptor parameterDescriptor) { for (KotlinType bound : parameterDescriptor.getUpperBounds()) { if (typeChecker.isSubtypeOf(argument, bound)) { if (!argument.getConstructor().equals(bound.getConstructor())) { return true; } } } return false; }
// See JLS 8, 8.4.4 Generic Methods // TODO: use TypeSubstitutor instead private static boolean areTypeParametersEquivalent( @NotNull TypeParameterDescriptor superTypeParameter, @NotNull TypeParameterDescriptor subTypeParameter, @NotNull KotlinTypeChecker typeChecker) { List<KotlinType> superBounds = superTypeParameter.getUpperBounds(); List<KotlinType> subBounds = new ArrayList<KotlinType>(subTypeParameter.getUpperBounds()); if (superBounds.size() != subBounds.size()) return false; outer: for (KotlinType superBound : superBounds) { ListIterator<KotlinType> it = subBounds.listIterator(); while (it.hasNext()) { KotlinType subBound = it.next(); if (areTypesEquivalent(superBound, subBound, typeChecker)) { it.remove(); continue outer; } } return false; } return true; }