Repository: open-telemetry/opentelemetry-java
File: sdk/trace/src/main/java/io/opentelemetry/sdk/trace/SdkSpan.java (Java)

Code before:
      }
      if (events.size() < spanLimits.getMaxNumberOfEvents()) {
        events.add(timedEvent);
      }
      totalRecordedEvents++;
    }
  }

  @Override
  public ReadWriteSpan setStatus(StatusCode statusCode, @Nullable String description) {
    if (statusCode == null) {
      return this;
    }
    synchronized (lock) {
      if (!isModifiableByCurrentThread()) {
        logger.log(Level.FINE, "Calling setStatus() on an ended Span.");
        return this;
      }

      // If current status is OK, ignore further attempts to change it
      if (this.status.getStatusCode() == StatusCode.OK) {
        logger.log(Level.FINE, "Calling setStatus() on a Span that is already set to OK.");
        return this;
      }

      // Ignore attempts ot set status to UNSET
      if (statusCode == StatusCode.UNSET) {
        logger.log(Level.FINE, "Ignoring call to setStatus() with status UNSET.");
        return this;
      }

      // Ignore description when status is not ERROR
      if (description != null && statusCode != StatusCode.ERROR) {
        logger.log(Level.FINE, "Ignoring setStatus() description since status is not ERROR.");
        description = null;
      }

      this.status = StatusData.create(statusCode, description);
    }
    return this;
  }

  @Override
  public ReadWriteSpan recordException(Throwable exception) {
    recordException(exception, Attributes.empty());
    return this;
  }

  @Override
  public ReadWriteSpan recordException(Throwable exception, Attributes additionalAttributes) {
    if (exception == null) {

Review comment (suggestion):
```suggestion
      // Ignore attempts to set status to UNSET
```

Code after:
      }
      if (events.size() < spanLimits.getMaxNumberOfEvents()) {
        events.add(timedEvent);
      }
      totalRecordedEvents++;
    }
  }

  @Override
  public ReadWriteSpan setStatus(StatusCode statusCode, @Nullable String description) {
    if (statusCode == null) {
      return this;
    }
    synchronized (lock) {
      if (!isModifiableByCurrentThread()) {
        logger.log(Level.FINE, "Calling setStatus() on an ended Span.");
        return this;
      }

      // If current status is OK, ignore further attempts to change it
      if (this.status.getStatusCode() == StatusCode.OK) {
        logger.log(Level.FINE, "Calling setStatus() on a Span that is already set to OK.");
        return this;
      }

      // Ignore attempts to set status to UNSET
      if (statusCode == StatusCode.UNSET) {
        logger.log(Level.FINE, "Ignoring call to setStatus() with status UNSET.");
        return this;
      }

      // Ignore description when status is not ERROR
      if (description != null && statusCode != StatusCode.ERROR) {
        logger.log(Level.FINE, "Ignoring setStatus() description since status is not ERROR.");
        description = null;
      }

      this.status = StatusData.create(statusCode, description);
    }
    return this;
  }

  @Override
  public ReadWriteSpan recordException(Throwable exception) {
    recordException(exception, Attributes.empty());
    return this;
  }

  @Override
  public ReadWriteSpan recordException(Throwable exception, Attributes additionalAttributes) {
    if (exception == null) {