mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1001063 - Add Assert class for debug assertions in Java code r=blassey
This commit is contained in:
parent
c58de9ee99
commit
83ee406fd2
@ -157,4 +157,11 @@ public class AppConstants {
|
||||
#else
|
||||
false;
|
||||
#endif
|
||||
|
||||
public static final boolean DEBUG_BUILD =
|
||||
#ifdef MOZ_DEBUG
|
||||
true;
|
||||
#else
|
||||
false;
|
||||
#endif
|
||||
}
|
||||
|
41
mobile/android/base/Assert.java
Normal file
41
mobile/android/base/Assert.java
Normal file
@ -0,0 +1,41 @@
|
||||
package org.mozilla.gecko;
|
||||
|
||||
public class Assert
|
||||
{
|
||||
private Assert() {}
|
||||
|
||||
public static void equals(Object a, Object b)
|
||||
{
|
||||
equals(a, b, null);
|
||||
}
|
||||
|
||||
public static void equals(Object a, Object b, String message)
|
||||
{
|
||||
Assert.isTrue(a.equals(b), message);
|
||||
}
|
||||
|
||||
public static void isTrue(boolean a)
|
||||
{
|
||||
isTrue(a, null);
|
||||
}
|
||||
|
||||
public static void isTrue(boolean a, String message)
|
||||
{
|
||||
if (!AppConstants.DEBUG_BUILD) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!a) {
|
||||
throw new AssertException(message);
|
||||
}
|
||||
}
|
||||
|
||||
public static class AssertException extends RuntimeException
|
||||
{
|
||||
private static final long serialVersionUID = 0L;
|
||||
|
||||
public AssertException(String message) {
|
||||
super(message);
|
||||
}
|
||||
}
|
||||
}
|
@ -40,6 +40,7 @@ DEFINES += \
|
||||
-DMOZ_APP_BUILDID=$(MOZ_APP_BUILDID) \
|
||||
-DMOZ_BUILD_TIMESTAMP=$(MOZ_BUILD_TIMESTAMP) \
|
||||
-DUA_BUILDID=$(UA_BUILDID) \
|
||||
-DMOZ_DEBUG=$(MOZ_DEBUG) \
|
||||
$(NULL)
|
||||
|
||||
GARBAGE += \
|
||||
|
@ -116,6 +116,7 @@ gbjar.sources += [
|
||||
'animation/ViewHelper.java',
|
||||
'ANRReporter.java',
|
||||
'AppNotificationClient.java',
|
||||
'Assert.java',
|
||||
'BaseGeckoInterface.java',
|
||||
'BrowserApp.java',
|
||||
'BrowserLocaleManager.java',
|
||||
|
Loading…
Reference in New Issue
Block a user