blob: 7b8c096702a4a5163fd8408770584cbdd1aca78b [file] [log] [blame]
// Copyright (c) 2022, the R8 project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
package com.android.tools.r8.ir.desugar.backports;
import java.lang.reflect.Constructor;
public final class AssertionErrorMethods {
public static AssertionError createAssertionError(String message, Throwable cause) {
try {
Constructor<AssertionError> twoArgsConstructor =
AssertionError.class.getDeclaredConstructor(String.class, Throwable.class);
return twoArgsConstructor.newInstance(message, cause);
} catch (Exception e) {
return new AssertionError(message);
}
}
}