(forgot a file)
Implements the Java assert statement in web mode via a compiler flag, "-ea". This is mimic the JVM option to enable assertions. When the option is not specified, the compiler will continue to optimize out all assert statements as it does currently.
Review by: bobv
git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@1696 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/dev/core/super/com/google/gwt/dev/jjs/intrinsic/com/google/gwt/lang/Exceptions.java b/dev/core/super/com/google/gwt/dev/jjs/intrinsic/com/google/gwt/lang/Exceptions.java
index 1894af6..63459d9 100644
--- a/dev/core/super/com/google/gwt/dev/jjs/intrinsic/com/google/gwt/lang/Exceptions.java
+++ b/dev/core/super/com/google/gwt/dev/jjs/intrinsic/com/google/gwt/lang/Exceptions.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2006 Google Inc.
+ * Copyright 2008 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
@@ -30,6 +30,45 @@
javaScriptExceptionDescription(e));
}
+ static boolean throwAssertionError() {
+ throw new AssertionError();
+ }
+
+ /*
+ * We use nonstandard naming here so it's easy for the compiler to map to
+ * method names based on primitive type name.
+ */
+ // CHECKSTYLE_OFF
+ static boolean throwAssertionError_boolean(boolean message) {
+ throw new AssertionError(message);
+ }
+
+ static boolean throwAssertionError_char(char message) {
+ throw new AssertionError(message);
+ }
+
+ static boolean throwAssertionError_double(double message) {
+ throw new AssertionError(message);
+ }
+
+ static boolean throwAssertionError_float(float message) {
+ throw new AssertionError(message);
+ }
+
+ static boolean throwAssertionError_int(int message) {
+ throw new AssertionError(message);
+ }
+
+ static boolean throwAssertionError_long(long message) {
+ throw new AssertionError(message);
+ }
+
+ static boolean throwAssertionError_Object(Object message) {
+ throw new AssertionError(message);
+ }
+
+ // CHECKSTYLE_ON
+
/**
* Returns the description of an unexpected JavaScript exception (not a normal
* Java one).