All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.google.common.truth.extensions.proto.AutoValue_DiffResult_SingularField Maven / Gradle / Ivy

The newest version!
package com.google.common.truth.extensions.proto;

import com.google.common.base.Optional;
import com.google.errorprone.annotations.concurrent.LazyInit;
import com.google.protobuf.TextFormat;
import java.lang.Iterable;
import java.lang.Object;
import java.lang.Override;
import java.lang.String;
import java.lang.SuppressWarnings;

final class AutoValue_DiffResult_SingularField extends $AutoValue_DiffResult_SingularField {
  @LazyInit
  @SuppressWarnings("Immutable")
  private transient volatile Object actualOrExpected;

  @LazyInit
  @SuppressWarnings("Immutable")
  private transient volatile Iterable childEntities;

  AutoValue_DiffResult_SingularField(TextFormat.Printer protoPrinter,
      RecursableDiffEntity.WithResultCode.Result result, Optional subScopeId,
      String fieldName, Optional actual, Optional expected,
      Optional breakdown, Optional unknownsBreakdown) {
    super(protoPrinter, result, subScopeId, fieldName, actual, expected, breakdown, unknownsBreakdown);
  }

  @Override
  Object actualOrExpected() {
    if (actualOrExpected == null) {
      synchronized (this) {
        if (actualOrExpected == null) {
          actualOrExpected = super.actualOrExpected();
          if (actualOrExpected == null) {
            throw new NullPointerException("actualOrExpected() cannot return null");
          }
        }
      }
    }
    return actualOrExpected;
  }

  @Override
  Iterable childEntities() {
    if (childEntities == null) {
      synchronized (this) {
        if (childEntities == null) {
          childEntities = super.childEntities();
          if (childEntities == null) {
            throw new NullPointerException("childEntities() cannot return null");
          }
        }
      }
    }
    return childEntities;
  }
}