It's defined in the language to happen, given the proper circumstances of a simple "if" testing an expression composed of constants and not exceeding a given complexity.
The thing it won't do is ignore syntax errors and undefined symbols in the "dead" leg. On Aug 1, 3:12 pm, RichardC <richard.crit...@googlemail.com> wrote: > Thank you, that's going to make my life easier. > > As I am still learning Java, can you tell me if the removal of "dead > code" is a feature of the Java language or is it unique to the Android > build chain? > > On Aug 1, 8:50 pm, Romain Guy <romain...@android.com> wrote: > > > > I have had to learn to live without conditional compliation. The only > > > area where I really miss having a lanugage constuct like "#ifdef" is > > > when I need to remove instrumentation and/or debugging code. > > > You can achieve this in Java using static final fields. The compiler > > is smart enough to remove if block whose condition evaluates to false > > at compile time (we use this a lot in Android's source code :). > > > -- > > Romain Guy > > Android framework engineer > > romain...@android.com > > > Note: please don't send private questions to me, as I don't have time > > to provide private support. All such questions should be posted on > > public forums, where I and others can see and answer them -- 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en