@Override
 TypeBinding substituteInferenceVariable(InferenceVariable var, TypeBinding substituteType) {
   if (this.pendingSubstitute != null) return this.pendingSubstitute;
   try {
     TypeBinding substitutedWildcard =
         this.wildcard.substituteInferenceVariable(var, substituteType);
     if (substitutedWildcard != this.wildcard) { // $IDENTITY-COMPARISON$
       CaptureBinding substitute = (CaptureBinding) clone(enclosingType());
       substitute.wildcard = (WildcardBinding) substitutedWildcard;
       this.pendingSubstitute = substitute;
       if (this.lowerBound != null)
         substitute.lowerBound = this.lowerBound.substituteInferenceVariable(var, substituteType);
       if (this.firstBound != null)
         substitute.firstBound = this.firstBound.substituteInferenceVariable(var, substituteType);
       if (this.superclass != null)
         substitute.superclass =
             (ReferenceBinding) this.superclass.substituteInferenceVariable(var, substituteType);
       if (this.superInterfaces != null) {
         int length = this.superInterfaces.length;
         substitute.superInterfaces = new ReferenceBinding[length];
         for (int i = 0; i < length; i++)
           substitute.superInterfaces[i] =
               (ReferenceBinding)
                   this.superInterfaces[i].substituteInferenceVariable(var, substituteType);
       }
       return substitute;
     }
     return this;
   } finally {
     this.pendingSubstitute = null;
   }
 }
 public CaptureBinding(
     WildcardBinding wildcard,
     ReferenceBinding sourceType,
     int start,
     int end,
     ASTNode cud,
     int captureID) {
   super(TypeConstants.WILDCARD_CAPTURE_NAME_PREFIX, wildcard.environment);
   this.wildcard = wildcard;
   this.modifiers =
       ClassFileConstants.AccPublic
           | ExtraCompilerModifiers.AccGenericSignature; // treat capture as public
   this.fPackage = wildcard.fPackage;
   this.sourceType = sourceType;
   this.start = start;
   this.end = end;
   this.captureID = captureID;
   this.tagBits |= TagBits.HasCapturedWildcard;
   this.cud = cud;
   if (wildcard.hasTypeAnnotations()) {
     // register an unannoted version before adding the annotated wildcard:
     CaptureBinding unannotated = (CaptureBinding) clone(null);
     unannotated.wildcard = (WildcardBinding) this.wildcard.unannotated();
     this.environment.getUnannotatedType(unannotated);
     this.id = unannotated.id; // transfer fresh id
     // now register this annotated type:
     this.environment.typeSystem.cacheDerivedType(this, unannotated, this);
     // propagate from wildcard to capture - use super version, because our own method propagates
     // type annotations in the opposite direction:
     super.setTypeAnnotations(
         wildcard.getTypeAnnotations(),
         wildcard.environment.globalOptions.isAnnotationBasedNullAnalysisEnabled);
     if (wildcard.hasNullTypeAnnotations()) this.tagBits |= TagBits.HasNullTypeAnnotation;
   } else {
     computeId(this.environment);
   }
 }
  @Override
  public TypeBinding withoutToplevelNullAnnotation() {
    if (!hasNullTypeAnnotations()) return this;
    if (this.wildcard != null && this.wildcard.hasNullTypeAnnotations()) {
      WildcardBinding newWildcard = (WildcardBinding) this.wildcard.withoutToplevelNullAnnotation();
      if (newWildcard != this.wildcard) { // $IDENTITY-COMPARISON$

        CaptureBinding newCapture =
            (CaptureBinding) this.environment.getUnannotatedType(this).clone(null);
        if (newWildcard.hasTypeAnnotations()) newCapture.tagBits |= TagBits.HasTypeAnnotations;
        newCapture.wildcard = newWildcard;

        // manually transfer the following two, because we are not in a context where we can call
        // initializeBounds():
        newCapture.superclass = this.superclass;
        newCapture.superInterfaces = this.superInterfaces;

        AnnotationBinding[] newAnnotations =
            this.environment.filterNullTypeAnnotations(this.typeAnnotations);
        return this.environment.createAnnotatedType(newCapture, newAnnotations);
      }
    }
    return super.withoutToplevelNullAnnotation();
  }