Closed Bug 757657 Opened 12 years ago Closed 3 years ago

Sometimes get "GeckoActivity.java:24: warning: [cast] redundant cast..." when building

Categories

(Firefox for Android Graveyard :: General, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED INCOMPLETE

People

(Reporter: drs, Unassigned)

Details

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[6]: *** [classes.dex] Error 1
make[6]: Leaving directory `/home/dsherk/mozilla-central/objdir-droid/mobile/android/base'
make[5]: *** [libs] Error 2
make[5]: Leaving directory `/home/dsherk/mozilla-central/objdir-droid/mobile/android'
make[4]: *** [libs_tier_app] Error 2
make[4]: Leaving directory `/home/dsherk/mozilla-central/objdir-droid'
make[3]: *** [tier_app] Error 2
make[3]: Leaving directory `/home/dsherk/mozilla-central/objdir-droid'
make[2]: *** [default] Error 2
make[2]: Leaving directory `/home/dsherk/mozilla-central/objdir-droid'
make[1]: *** [realbuild] Error 2
make[1]: 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.
Assignee: nobody → bugmail.mozilla
Status: UNCONFIRMED → NEW
Ever confirmed: true
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.
Assignee: bugmail.mozilla → nobody
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.
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → WORKSFORME
This is happening for me, 3 times today.
Status: RESOLVED → REOPENED
Resolution: WORKSFORME → ---
It's a javac bug; doing a clean in mobile/android/base resolves it.
We have completed our launch of our new Firefox on Android. The development of the new versions use GitHub for issue tracking. If the bug report still reproduces in a current version of [Firefox on Android nightly](https://play.google.com/store/apps/details?id=org.mozilla.fenix) an issue can be reported at the [Fenix GitHub project](https://github.com/mozilla-mobile/fenix/). If you want to discuss your report please use [Mozilla's chat](https://wiki.mozilla.org/Matrix#Connect_to_Matrix) server https://chat.mozilla.org and join the [#fenix](https://chat.mozilla.org/#/room/#fenix:mozilla.org) channel.
Status: REOPENED → RESOLVED
Closed: 12 years ago3 years ago
Resolution: --- → INCOMPLETE
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in before you can comment on or make changes to this bug.