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

br.com.objectos.lang.ThrowablesJava6 Maven / Gradle / Ivy

The newest version!
/*
 * Copyright 2021 Objectos Software LTDA.
 *
 * Reprodução parcial ou total proibida.
 */
package br.com.objectos.lang;

import static br.com.objectos.lang.Lang.checkNotNull;

import br.com.objectos.logging.Event1;
import br.com.objectos.logging.Logger;
import br.com.objectos.logging.Logging;
import br.com.objectos.multirelease.Singleton;

final class ThrowablesJava6 extends Throwables {

  @Singleton.Field
  static final Throwables INSTANCE = new ThrowablesJava6();

  private static final Throwable[] EMPTY = new Throwable[0];

  private static final Event1 SUPPRESSED;

  static {
    Class s;
    s = Throwables.class;

    SUPPRESSED = Logging.warn(s, "SUPPRESSED", Exception.class);
  }

  private final Logger logger = Logging.getNoopLogger();

  private ThrowablesJava6() {}

  @Override
  public final Exception addSuppressed(Exception exception, Exception suppressed) {
    checkNotNull(suppressed, "suppressed == null");

    if (exception != null) {
      logger.log(SUPPRESSED, suppressed);

      return exception;
    } else {
      return suppressed;
    }
  }

  @Override
  public final Throwable[] getSuppressed(Throwable throwable) {
    checkNotNull(throwable, "throwable == null");

    return EMPTY;
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy