Thu, 15 Jan 2015 21:03:48 +0100
Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)
michael@0 | 1 | package org.mozilla.gecko; |
michael@0 | 2 | |
michael@0 | 3 | public class Assert |
michael@0 | 4 | { |
michael@0 | 5 | private Assert() {} |
michael@0 | 6 | |
michael@0 | 7 | public static void equals(Object a, Object b) |
michael@0 | 8 | { |
michael@0 | 9 | equals(a, b, null); |
michael@0 | 10 | } |
michael@0 | 11 | |
michael@0 | 12 | public static void equals(Object a, Object b, String message) |
michael@0 | 13 | { |
michael@0 | 14 | Assert.isTrue(a.equals(b), message); |
michael@0 | 15 | } |
michael@0 | 16 | |
michael@0 | 17 | public static void isTrue(boolean a) |
michael@0 | 18 | { |
michael@0 | 19 | isTrue(a, null); |
michael@0 | 20 | } |
michael@0 | 21 | |
michael@0 | 22 | public static void isTrue(boolean a, String message) |
michael@0 | 23 | { |
michael@0 | 24 | if (!AppConstants.DEBUG_BUILD) { |
michael@0 | 25 | return; |
michael@0 | 26 | } |
michael@0 | 27 | |
michael@0 | 28 | if (!a) { |
michael@0 | 29 | throw new AssertException(message); |
michael@0 | 30 | } |
michael@0 | 31 | } |
michael@0 | 32 | |
michael@0 | 33 | public static class AssertException extends RuntimeException |
michael@0 | 34 | { |
michael@0 | 35 | private static final long serialVersionUID = 0L; |
michael@0 | 36 | |
michael@0 | 37 | public AssertException(String message) { |
michael@0 | 38 | super(message); |
michael@0 | 39 | } |
michael@0 | 40 | } |
michael@0 | 41 | } |