protected boolean canResolveTo(LightweightTypeReference reference, List<LightweightBoundTypeArgument> allHints) { List<LightweightBoundTypeArgument> inferredHints = Lists.newArrayListWithCapacity(allHints.size()); List<LightweightBoundTypeArgument> effectiveHints = Lists.newArrayListWithCapacity(allHints.size()); EnumSet<VarianceInfo> varianceHints = EnumSet.noneOf(VarianceInfo.class); for(LightweightBoundTypeArgument hint: allHints) { if (hint.getOrigin() instanceof VarianceInfo) { varianceHints.add((VarianceInfo) hint.getOrigin()); } else { effectiveHints.add(hint); if (hint.getSource() == BoundTypeArgumentSource.INFERRED) { inferredHints.add(hint); } } } if (effectiveHints.isEmpty()) return false; boolean result = getServices().getBoundTypeArgumentMerger().isPossibleMergeResult(!inferredHints.isEmpty() ? inferredHints : effectiveHints, reference); return result; }
@Override public JvmTypeReference toTypeReference() { if (internalGetResolvedTo() != null) { return resolvedTo.toTypeReference(); } XComputedTypeReference result = getServices().getXtypeFactory().createXComputedTypeReference(); result.setTypeProvider(new UnboundTypeReferenceResolver(this)); return result; }
LightweightMergedBoundTypeArgument typeArgument = getServices().getBoundTypeArgumentMerger().merge(!inferredHints.isEmpty() ? inferredHints : effectiveHints, getOwner()); if (typeArgument != null) { resolvedTo = typeArgument.getTypeReference();