Skip to content

Commit

Permalink
remove assert, too many reasons for null so just check and be happy
Browse files Browse the repository at this point in the history
  • Loading branch information
stephan-herrmann committed May 30, 2024
1 parent 4221238 commit 7b7820d
Showing 1 changed file with 1 addition and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -969,9 +969,7 @@ public TypeBinding resolveType(BlockScope scope) {
if (this.receiver instanceof CastExpression) {
// this check was suppressed while resolving receiver, check now based on this.binding.declaringClass
TypeBinding uncastedReceiverType = ((CastExpression)this.receiver).expression.resolvedType;
if (uncastedReceiverType == null) {
assert this.outerInferenceContext != null : "null should only happen when nested in unfinished type inference"; //$NON-NLS-1$
} else if (uncastedReceiverType.isCompatibleWith(this.binding.declaringClass)) {
if (uncastedReceiverType != null && uncastedReceiverType.isCompatibleWith(this.binding.declaringClass)) {
if (!scope.environment().usesNullTypeAnnotations() || !NullAnnotationMatching.analyse(this.actualReceiverType, uncastedReceiverType, -1).isAnyMismatch()) {
scope.problemReporter().unnecessaryCast((CastExpression) this.receiver);
}
Expand Down

0 comments on commit 7b7820d

Please sign in to comment.