@Override public void setTypeAnnotations(AnnotationBinding[] annotations, boolean evalNullAnnotations) { super.setTypeAnnotations(annotations, evalNullAnnotations); if (annotations != Binding.NO_ANNOTATIONS && this.wildcard != null) { // keep annotations in sync, propagate from capture to its wildcard: this.wildcard = (WildcardBinding) this.wildcard.environment.createAnnotatedType(this.wildcard, annotations); } }
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); } }