Just FYI, the BuildConfig.DEBUG = Boolean.parseBoolean("true") setting is
just there to trick IntelliJ's code analyzer into considering the value
non-constant, such that it doesn't give you a warning that
   if (BuildConfig.DEBUG) {
is "always" true and can therefore be removed. It means that the value also
actually isn't constant as far as Javac is concerned, so the check code
will make it into the bytecode. For DEBUG=true, that doesn't seem like it's
a problem.

When you're building a release target, it will set it to DEBUG = false,
*not* DEBUG = Boolean.parseBoolean("false"), so in that case it really is a
constant and the entire if statement's body is physically removed.


On Tue, Feb 11, 2014 at 11:35 AM, Jake Wharton <[email protected]>wrote:

> Hmm you're right. It doesn't work for either case. It was just a thought
> that I should have tested before blasting out to this list.
>
>
> ---
> Jake Wharton
> http://about.me/jakewharton
>
>
> On Tue, Feb 11, 2014 at 10:55 AM, Xavier Ducrohet <[email protected]> wrote:
>
>> Can you expand on what you have in mind here? Are you talking about the
>> Boolean.parseBoolean("true")?
>>
>> I'm not sure about switch statements, the tableswitch opcode doesn't work
>> with variable values, so that would have to be resolved at compile time
>> anyway.
>>
>>
>> On Tue, Feb 11, 2014 at 10:18 AM, Jake Wharton <[email protected]>wrote:
>>
>>> Can we bring back final constants in the generated R for library
>>> projects using the same technique as BuildConfig.DEBUG? This would prevent
>>> javac from inlining while allowing the use in switch statements, annotation
>>> values, etc.
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "adt-dev" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>
>>
>>
>> --
>> Xavier Ducrohet
>> Android SDK Tech Lead
>> Google Inc.
>> http://developer.android.com | http://tools.android.com
>>
>> Please do not send me questions directly. Thanks!
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "adt-dev" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "adt-dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
You received this message because you are subscribed to the Google Groups 
"adt-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to