protected void addNonRecursiveHints(List<LightweightBoundTypeArgument> hints, Set<Object> seenHandles, List<LightweightBoundTypeArgument> result) { for(LightweightBoundTypeArgument hint: hints) { LightweightTypeReference reference = hint.getTypeReference(); if (reference instanceof UnboundTypeReference) { addNonRecursiveHints(hint, (UnboundTypeReference)reference, seenHandles, result); } else { if (!result.contains(hint)) result.add(hint); } } }
public List<LightweightBoundTypeArgument> getAllHints(Object handle) { List<LightweightBoundTypeArgument> actualHints = getHints(handle); int i = 0; while(i < actualHints.size()) { LightweightBoundTypeArgument hint = actualHints.get(i); if (hint.getTypeReference() instanceof UnboundTypeReference) { break; } i++; } if (i >= actualHints.size()) return actualHints; List<LightweightBoundTypeArgument> transitivity = Lists.newArrayList(); Set<Object> seenHandles = Sets.newHashSet(handle); transitivity.addAll(actualHints.subList(0, i)); List<LightweightBoundTypeArgument> allRemaining = actualHints.subList(i, actualHints.size()); addNonRecursiveHints(allRemaining, seenHandles, transitivity); return transitivity; }
protected void addNonRecursiveHints(LightweightBoundTypeArgument original, UnboundTypeReference reference, Set<Object> seenHandles, List<LightweightBoundTypeArgument> result) { Object otherHandle = reference.getHandle(); if (seenHandles.add(otherHandle)) { if (isResolved(otherHandle)) { result.addAll(getHints(otherHandle)); } else { addNonRecursiveHints(original, getHints(otherHandle), seenHandles, result); } } }
LightweightTypeReference reference = hint.getTypeReference(); if (reference instanceof UnboundTypeReference) { addNonRecursiveHints(original, (UnboundTypeReference)reference, seenHandles, result); } else { if (original.getDeclaredVariance() == VarianceInfo.IN && hint.getTypeReference() instanceof WildcardTypeReference) { LightweightTypeReference upperBound = hint.getTypeReference().getUpperBoundSubstitute(); if (upperBound instanceof UnboundTypeReference) { addNonRecursiveHints(original, (UnboundTypeReference)upperBound, seenHandles, result); } else { LightweightBoundTypeArgument delegateHint = new LightweightBoundTypeArgument(