protected boolean hasSignificantHints(List<LightweightBoundTypeArgument> hints, boolean constraintsAreSignificant) { for (LightweightBoundTypeArgument hint: hints) { if (!(hint.getOrigin() instanceof VarianceInfo)) { if (constraintsAreSignificant || hint.getSource() != BoundTypeArgumentSource.CONSTRAINT) return true; } } return false; }
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; }
protected LightweightBoundTypeArgument copyBoundTypeArgument(LightweightTypeReference typeReference, LightweightBoundTypeArgument boundTypeArgument) { return new LightweightBoundTypeArgument(typeReference, boundTypeArgument.getSource(), boundTypeArgument.getOrigin(), boundTypeArgument.getDeclaredVariance(), boundTypeArgument.getActualVariance()); }
LightweightBoundTypeArgument copy = new LightweightBoundTypeArgument( parentHint.getTypeReference().copyInto(getReferenceOwner()), parentHint.getSource(), parentHint.getOrigin(), parentHint.getDeclaredVariance(), parentHint.getActualVariance()); parentHint.getTypeReference().copyInto(getReferenceOwner()), parentHint.getSource(), parentHint.getOrigin(), parentHint.getDeclaredVariance(), parentHint.getActualVariance());
Set<Object> seenOrigin = Sets.newHashSet(); for(LightweightBoundTypeArgument boundTypeArgument: allArguments) { Object origin = boundTypeArgument.getOrigin(); switch(boundTypeArgument.getDeclaredVariance()) { case INVARIANT:
} else { LightweightBoundTypeArgument delegateHint = new LightweightBoundTypeArgument( upperBound, original.getSource(), hint.getOrigin(), hint.getDeclaredVariance(), original.getActualVariance()); result.add(delegateHint);
List<LightweightBoundTypeArgument> boundTypeArguments = hint.getValue(); for(LightweightBoundTypeArgument boundTypeArgument: boundTypeArguments) { if (boundTypeArgument.getOrigin() instanceof VarianceInfo) { parent.acceptHint(hint.getKey(), boundTypeArgument); } else { LightweightBoundTypeArgument copy = new LightweightBoundTypeArgument( boundTypeArgument.getTypeReference().copyInto(parent.getReferenceOwner()), boundTypeArgument.getSource(), boundTypeArgument.getOrigin(), boundTypeArgument.getDeclaredVariance(), boundTypeArgument.getActualVariance());
hint.getTypeReference(), BoundTypeArgumentSource.INFERRED, hint.getOrigin(), hint.getDeclaredVariance(), hint.getActualVariance());