protected LightweightBoundTypeArgument boundByConstraint(LightweightTypeReference reference, Object origin) { return new LightweightBoundTypeArgument(reference.getWrapperTypeIfPrimitive(), BoundTypeArgumentSource.CONSTRAINT, origin, VarianceInfo.OUT, VarianceInfo.OUT); }
public void acceptHint(VarianceInfo variance) { acceptHint(new LightweightBoundTypeArgument(null, null, variance, null, null)); }
protected LightweightBoundTypeArgument copyBoundTypeArgument(LightweightTypeReference typeReference, LightweightBoundTypeArgument boundTypeArgument) { return new LightweightBoundTypeArgument(typeReference, boundTypeArgument.getSource(), boundTypeArgument.getOrigin(), boundTypeArgument.getDeclaredVariance(), boundTypeArgument.getActualVariance()); }
private LightweightBoundTypeArgument boundByInference(LightweightTypeReference reference) { return new LightweightBoundTypeArgument(reference.getWrapperTypeIfPrimitive(), BoundTypeArgumentSource.INFERRED, getOrigin(), getExpectedVariance(), getActualVariance()); } }
protected LightweightBoundTypeArgument boundByDefaultSource(LightweightTypeReference reference) { return new LightweightBoundTypeArgument(reference.getWrapperTypeIfPrimitive(), defaultSource, getOrigin(), getExpectedVariance(), getActualVariance()); }
protected void resolveAgainstConstraints() { TypeParameterByConstraintSubstitutor unboundSubstitutor = new TypeParameterByConstraintSubstitutor( Collections.<JvmTypeParameter, LightweightMergedBoundTypeArgument>emptyMap(), getOwner(), true); LightweightTypeReference substitute = unboundSubstitutor.substitute(getOwner().newParameterizedTypeReference(typeParameter)); getOwner().acceptHint(getHandle(), new LightweightBoundTypeArgument(substitute, BoundTypeArgumentSource.RESOLVED, this, VarianceInfo.INVARIANT, VarianceInfo.INVARIANT)); resolvedTo = substitute; }
if (parentHints.size() == 1 && getParent().isResolved(handle)) { LightweightBoundTypeArgument parentHint = parentHints.get(0); LightweightBoundTypeArgument copy = new LightweightBoundTypeArgument( parentHint.getTypeReference().copyInto(getReferenceOwner()), parentHint.getSource(), parentHint.getOrigin(), withParentHints.add(parentHint); } else { LightweightBoundTypeArgument copy = new LightweightBoundTypeArgument( parentHint.getTypeReference().copyInto(getReferenceOwner()), parentHint.getSource(),
acceptHint(new LightweightBoundTypeArgument(hint.getWrapperTypeIfPrimitive(), source, origin, expectedVariance, actualVariance));
public void acceptHint(LightweightBoundTypeArgument hint) { if (internalIsResolved()) { throw new IllegalStateException("Cannot add hints to a resolved reference"); } if (hint.getSource() == BoundTypeArgumentSource.EXPLICIT) { LightweightTypeReference reference = hint.getTypeReference(); if (!(reference instanceof ParameterizedTypeReference) && !reference.isArray() && !reference.isUnknown()) { throw new IllegalArgumentException("cannot set " + hint + " as explicit hint"); } if (!getAllHints().isEmpty()) { throw new IllegalStateException("Cannot set explicit hint if other hints are present: " + getAllHints()); } this.resolvedTo = reference; getOwner().acceptHint(getHandle(), new LightweightBoundTypeArgument(resolvedTo, BoundTypeArgumentSource.RESOLVED, this, hint.getDeclaredVariance(), hint.getActualVariance())); return; } getOwner().acceptHint(this.getHandle(), hint); }
addNonRecursiveHints(original, (UnboundTypeReference)upperBound, seenHandles, result); } else { LightweightBoundTypeArgument delegateHint = new LightweightBoundTypeArgument( upperBound, original.getSource(), hint.getOrigin(), hint.getDeclaredVariance(), original.getActualVariance()); result.add(delegateHint);
getOwner().acceptHint(getHandle(), new LightweightBoundTypeArgument( resolvedTo, BoundTypeArgumentSource.RESOLVED,
parent.acceptHint(hint.getKey(), boundTypeArgument); } else { LightweightBoundTypeArgument copy = new LightweightBoundTypeArgument( boundTypeArgument.getTypeReference().copyInto(parent.getReferenceOwner()), boundTypeArgument.getSource(), boundTypeArgument.getOrigin(),