From f95ae1ab5be49ea28bafa104cda5ce28293dc883 Mon Sep 17 00:00:00 2001 From: "igor%mir2.org" Date: Wed, 6 Aug 2003 07:37:27 +0000 Subject: [PATCH] I changed Context.codeBug to return RuntimeException instead of void to be able to wright "throw Context.codeBug()" when simple "Context.codeBug()" leads to a compile error about unreachable code or missed return. --- js/rhino/src/org/mozilla/javascript/Context.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/js/rhino/src/org/mozilla/javascript/Context.java b/js/rhino/src/org/mozilla/javascript/Context.java index 29b893e6370a..76d78f7ac284 100644 --- a/js/rhino/src/org/mozilla/javascript/Context.java +++ b/js/rhino/src/org/mozilla/javascript/Context.java @@ -2094,8 +2094,13 @@ public class Context { /** * Throws RuntimeException to indicate failed assertion. + * The function never returns and its return type is RuntimeException + * only to be able to write throw Context.codeBug() if plain + * Context.codeBug() triggers unreachable code error. */ - public static void codeBug() throws RuntimeException { + public static RuntimeException codeBug() + throws RuntimeException + { throw new RuntimeException("FAILED ASSERTION"); }