diff options
Diffstat (limited to 'gallerycommon/src/com/android/gallery3d/common')
-rw-r--r-- | gallerycommon/src/com/android/gallery3d/common/Utils.java | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/gallerycommon/src/com/android/gallery3d/common/Utils.java b/gallerycommon/src/com/android/gallery3d/common/Utils.java index ea289a628..6996015a3 100644 --- a/gallerycommon/src/com/android/gallery3d/common/Utils.java +++ b/gallerycommon/src/com/android/gallery3d/common/Utils.java @@ -54,12 +54,14 @@ public class Utils { } } - // Throws AssertionError if the input is false. - public static void assertTrue(boolean cond, String message, Object ... args) { - if (!cond) { - throw new AssertionError( - args.length == 0 ? message : String.format(message, args)); - } + // Throws AssertionError with the message. We had a method having the form + // assertTrue(boolean cond, String message, Object ... args); + // However a call to that method will cause memory allocation even if the + // condition is false (due to autoboxing generated by "Object ... args"), + // so we don't use that anymore. + public static void fail(String message, Object ... args) { + throw new AssertionError( + args.length == 0 ? message : String.format(message, args)); } // Throws NullPointerException if the input is null. |