[android-developers] Re: Making the Java assert statement work
On Jun 16, 12:26 am, A Curious Developer <imdb...@yahoo.com> wrote:
> But ... I noticed that assert statements bloat the .apk, which seems
> like a bad thing. So I am now using a pattern of checking a static
> final constant: if(ASSERTS) { asserts( someCondition, "Some
> explanation" ); }
Java-language assert statements turn into something like:
static final boolean assertionsDisabled = desiredAssertionStatus()
if (!assertionsDisabled) {
test assert
}
The code is always there, but it gets stepped around if assertions are
disabled. You'll pay for the static lookup in any code that doesn't
get compiled by the JIT.
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home