public void resolveReceiver() {
    if (this.receiver == null) return;

    if (this.receiver.modifiers != 0) {
      this.scope
          .problemReporter()
          .illegalModifiers(
              this.receiver.declarationSourceStart, this.receiver.declarationSourceEnd);
    }

    TypeBinding resolvedReceiverType = this.receiver.type.resolvedType;
    if (this.binding == null
        || resolvedReceiverType == null
        || !resolvedReceiverType.isValidBinding()) {
      return;
    }

    ReferenceBinding declaringClass = this.binding.declaringClass;
    /* neither static methods nor methods in anonymous types can have explicit 'this' */
    if (this.isStatic() || declaringClass.isAnonymousType()) {
      this.scope.problemReporter().disallowedThisParameter(this.receiver);
      return; // No need to do further validation
    }

    ReferenceBinding enclosingReceiver = this.scope.enclosingReceiverType();
    if (this.isConstructor()) {
      /* Only non static member types or local types can declare explicit 'this' params in constructors */
      if (declaringClass.isStatic()
          || (declaringClass.tagBits & (TagBits.IsLocalType | TagBits.IsMemberType)) == 0) {
          /* neither member nor local type */
        this.scope.problemReporter().disallowedThisParameter(this.receiver);
        return; // No need to do further validation
      }
      enclosingReceiver = enclosingReceiver.enclosingType();
    }

    char[][] tokens =
        (this.receiver.qualifyingName == null) ? null : this.receiver.qualifyingName.getName();
    if (this.isConstructor()) {
      if (tokens == null
          || tokens.length > 1
          || !CharOperation.equals(enclosingReceiver.sourceName(), tokens[0])) {
        this.scope
            .problemReporter()
            .illegalQualifierForExplicitThis(this.receiver, enclosingReceiver);
        this.receiver.qualifyingName = null;
      }
    } else if (tokens != null && tokens.length > 0) {
      this.scope.problemReporter().illegalQualifierForExplicitThis2(this.receiver);
      this.receiver.qualifyingName = null;
    }

    if (TypeBinding.notEquals(enclosingReceiver, resolvedReceiverType)) {
      this.scope.problemReporter().illegalTypeForExplicitThis(this.receiver, enclosingReceiver);
    }

    if (this.receiver.type.hasNullTypeAnnotation(AnnotationPosition.ANY)) {
      this.scope.problemReporter().nullAnnotationUnsupportedLocation(this.receiver.type);
    }
  }