mobile/android/base/Assert.java

Thu, 15 Jan 2015 21:03:48 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 21:03:48 +0100
branch
TOR_BUG_9701
changeset 11
deefc01c0e14
permissions
-rw-r--r--

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.)

     1 package org.mozilla.gecko;
     3 public class Assert
     4 {
     5     private Assert() {}
     7     public static void equals(Object a, Object b)
     8     {
     9         equals(a, b, null);
    10     }
    12     public static void equals(Object a, Object b, String message)
    13     {
    14         Assert.isTrue(a.equals(b), message);
    15     }
    17     public static void isTrue(boolean a)
    18     {
    19         isTrue(a, null);
    20     }
    22     public static void isTrue(boolean a, String message)
    23     {
    24         if (!AppConstants.DEBUG_BUILD) {
    25             return;
    26         }
    28         if (!a) {
    29             throw new AssertException(message);
    30         }
    31     }
    33     public static class AssertException extends RuntimeException
    34     {
    35         private static final long serialVersionUID = 0L;
    37         public AssertException(String message) {
    38             super(message);
    39         }
    40     }
    41 }

mercurial