public TypeBinding combineTypeAnnotations(TypeBinding substitute) { if (hasTypeAnnotations()) { // may need to merge annotations from the original variable and from substitution: if (hasRelevantTypeUseNullAnnotations()) { // explicit type use null annotation overrides any annots on type parameter and concrete // type arguments substitute = substitute.withoutToplevelNullAnnotation(); } if (this.typeAnnotations != Binding.NO_ANNOTATIONS) return this.environment.createAnnotatedType(substitute, this.typeAnnotations); // annots on originalVariable not relevant, and substitute has annots, keep substitute // unmodified: } return substitute; }
private TypeBinding nullMismatchOnBound( TypeParameter parameter, TypeBinding boundType, long superNullTagBits, long nullTagBits, Scope scope) { // not finding bound should be considered a compiler bug TypeReference bound = findBound(boundType, parameter); Annotation ann = bound.findAnnotation(superNullTagBits); if (ann != null) { // explicit annotation: error scope.problemReporter().contradictoryNullAnnotationsOnBounds(ann, nullTagBits); this.tagBits &= ~TagBits.AnnotationNullMASK; } else { // implicit annotation: let the new one override return boundType.withoutToplevelNullAnnotation(); } return boundType; }