I using OpenJDK 7, I sometimes get the following error when building: GeckoActivity.java:24: warning: [cast] redundant cast to org.mozilla.gecko.GeckoApplication ((GeckoApplication) getApplication()).onActivityPause(this); ^ GeckoActivity.java:33: warning: [cast] redundant cast to org.mozilla.gecko.GeckoApplication ((GeckoApplication) getApplication()).onActivityResume(this); ^ GeckoActivity.java:70: warning: [cast] redundant cast to org.mozilla.gecko.GeckoApplication return ((GeckoApplication) getApplication()).isApplicationInBackground(); ^ error: warnings found and -Werror specified 1 error 3 warnings make: *** [classes.dex] Error 1 make: Leaving directory `/home/dsherk/mozilla-central/objdir-droid/mobile/android/base' make: *** [libs] Error 2 make: Leaving directory `/home/dsherk/mozilla-central/objdir-droid/mobile/android' make: *** [libs_tier_app] Error 2 make: Leaving directory `/home/dsherk/mozilla-central/objdir-droid' make: *** [tier_app] Error 2 make: Leaving directory `/home/dsherk/mozilla-central/objdir-droid' make: *** [default] Error 2 make: Leaving directory `/home/dsherk/mozilla-central/objdir-droid' make: *** [realbuild] Error 2 make: Leaving directory `/home/dsherk/mozilla-central' make: *** [build] Error 2 This never happens on a fresh checkout. Clobbering fixes it. kats suspects that it is caused by the instanceof check directly above the cast, which causes there to be two instanceof calls in the bytecode.
I'm unable to reproduce this locally building with OpenJDK 7 on Linux. I'm also confused as to why it would never happen on a clobber build or fresh checkout; that implies it's not what I thought but that something is being cached somewhere. Does your compiler have any modifications or extensions or anything of that sort?
Unassigning to myself since I can't repro it and therefore can't debug it.
Can you provide a suggested fix so I can try it next time I get it?
My best guess involves removing the two "instanceof GeckoApplication" checks entirely. The isApplicationInBackground function doesn't do the instanceof check, which the compiler might mistake as a hint that getApplication() always returns a GeckoApplication, making the casts redundant.
I haven't had this in several days, in contrast to before where it was several times a day. I haven't applied any fix so I'm not sure whether it has just gone away or I was unlucky before. I'm closing this for now and I'll re-open it if it comes up again.
This is happening for me, 3 times today.
It's a javac bug; doing a clean in mobile/android/base resolves it.