io.opentelemetry.instrumentation.test.utils.ExceptionUtils Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of opentelemetry-testing-common Show documentation
Show all versions of opentelemetry-testing-common Show documentation
OpenTelemetry Javaagent testing commons
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/
package io.opentelemetry.instrumentation.test.utils;
public final class ExceptionUtils {
@SuppressWarnings("unchecked")
static RuntimeException sneakyThrow(Throwable t) {
if (t == null) {
throw new NullPointerException("t");
}
return ExceptionUtils.sneakyThrow0(t);
}
// Exactly what we want
@SuppressWarnings({"TypeParameterUnusedInFormals", "unchecked"})
private static T sneakyThrow0(Throwable t) throws T {
throw (T) t;
}
private ExceptionUtils() {}
}