|
Lines 484-489
public class ParameterizedGenericMethodBinding extends ParameterizedMethodBindin
Link Here
|
| 484 |
this.defaultNullness = originalMethod.defaultNullness; |
484 |
this.defaultNullness = originalMethod.defaultNullness; |
| 485 |
} |
485 |
} |
| 486 |
|
486 |
|
|
|
487 |
/** |
| 488 |
* Override NonNull with Nullable for return type. |
| 489 |
*/ |
| 490 |
private TypeBinding substitutedConflictingNullAnnotationReturnType(MethodBinding method, LookupEnvironment env) { |
| 491 |
// error case where exception type variable would have been substituted by a non-reference type (207573) |
| 492 |
TypeBinding substitutedReturnType = Scope.substitute(this, method.returnType); |
| 493 |
if (!env.globalOptions.isAnnotationBasedNullAnalysisEnabled) |
| 494 |
return substitutedReturnType; |
| 495 |
|
| 496 |
// No conflicting null annotations (NonNull and Nullable). |
| 497 |
if ((substitutedReturnType.tagBits & TagBits.AnnotationNullMASK) != TagBits.AnnotationNullMASK) |
| 498 |
return substitutedReturnType; |
| 499 |
|
| 500 |
// We should not suppress errors where user annotated the return type with both NonNull |
| 501 |
// and Nullable explicitly. |
| 502 |
if ((method.returnType.tagBits & TagBits.AnnotationNullable) == TagBits.AnnotationNullable |
| 503 |
&& (method.returnType.tagBits & TagBits.AnnotationNonNull) != TagBits.AnnotationNonNull) { |
| 504 |
AnnotationBinding[] annotationBinding = substitutedReturnType.typeAnnotations; |
| 505 |
AnnotationBinding[] newbies = new AnnotationBinding[annotationBinding.length-1]; |
| 506 |
for (int i = 0, length = annotationBinding.length, j = 0; i < length; i++) { |
| 507 |
if (annotationBinding[i].type.id != TypeIds.T_ConfiguredAnnotationNonNull) |
| 508 |
newbies[j++] = annotationBinding[i]; |
| 509 |
} |
| 510 |
substitutedReturnType.typeAnnotations = newbies; |
| 511 |
substitutedReturnType.tagBits &= ~TagBits.AnnotationNonNull; |
| 512 |
} |
| 513 |
return substitutedReturnType; |
| 514 |
} |
| 515 |
|
| 487 |
/** |
516 |
/** |
| 488 |
* Create method of parameterized type, substituting original parameters with type arguments. |
517 |
* Create method of parameterized type, substituting original parameters with type arguments. |
| 489 |
*/ |
518 |
*/ |
|
Lines 498-505
public class ParameterizedGenericMethodBinding extends ParameterizedMethodBindin
Link Here
|
| 498 |
this.tagBits = originalMethod.tagBits; |
527 |
this.tagBits = originalMethod.tagBits; |
| 499 |
this.originalMethod = originalMethod; |
528 |
this.originalMethod = originalMethod; |
| 500 |
this.parameters = Scope.substitute(this, originalMethod.parameters); |
529 |
this.parameters = Scope.substitute(this, originalMethod.parameters); |
| 501 |
// error case where exception type variable would have been substituted by a non-reference type (207573) |
530 |
this.returnType = substitutedConflictingNullAnnotationReturnType(originalMethod, environment); |
| 502 |
this.returnType = Scope.substitute(this, originalMethod.returnType); |
|
|
| 503 |
this.thrownExceptions = Scope.substitute(this, originalMethod.thrownExceptions); |
531 |
this.thrownExceptions = Scope.substitute(this, originalMethod.thrownExceptions); |
| 504 |
if (this.thrownExceptions == null) this.thrownExceptions = Binding.NO_EXCEPTIONS; |
532 |
if (this.thrownExceptions == null) this.thrownExceptions = Binding.NO_EXCEPTIONS; |
| 505 |
checkMissingType: { |
533 |
checkMissingType: { |