Skip to content

Commit 50f51ae

Browse files
committed
Fix dumpStackAndThrow; mark with an always-fail contract
1 parent ccb4595 commit 50f51ae

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

src/main/java/net/modfest/fireblanket/diagnostics/ForbiddenStackWalker.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import com.mojang.logging.LogUtils;
44
import org.jetbrains.annotations.ApiStatus;
5+
import org.jetbrains.annotations.Contract;
56
import org.jetbrains.annotations.NotNull;
67
import org.jetbrains.annotations.Nullable;
78
import org.slf4j.Logger;
@@ -345,17 +346,17 @@ public static void expectJailbreak() throws IllegalStateException {
345346
* @see #dumpStack(Object...)
346347
*/
347348
@SuppressWarnings("unused") // API
349+
@Contract("_, _ -> fail")
348350
public static <T extends Throwable> void dumpStackAndThrow(
349351
final @Nullable Supplier<@Nullable T> throwable,
350352
final @Nullable Object @Nullable ... context
351353
) throws T {
352354
if (isAlreadyDumping()) {
353355
logger.warn("Terminating recursive call.");
354-
return;
356+
} else {
357+
dump(context);
355358
}
356359

357-
dump(context);
358-
359360
// If we didn't get an exception provider for some reason,
360361
// fall back to throwing an assertion error instead.
361362
if (throwable == null) {

0 commit comments

Comments
 (0)