Closed Bug 1510971 Opened 6 years ago Closed 6 months ago

Java Warning: Redundant 'if' statement

Categories

(GeckoView :: General, defect, P5)

Unspecified
Android

Tracking

(firefox120 wontfix, firefox121 fixed)

RESOLVED FIXED
121 Branch
Tracking Status
firefox120 --- wontfix
firefox121 --- fixed

People

(Reporter: fluffyemily, Assigned: Logan, Mentored)

References

(Blocks 1 open bug)

Details

(Keywords: good-first-bug)

Attachments

(1 file, 5 obsolete files)

Reports if statements which can be simplified to single assignment, return or assert statements.
For example: 
    if (foo()) {
       return true;
    } else {
       return false;
    }
can be simplified to 
    return foo();

Affected Classes:

ColorInfo
FileUtils
GamepadUtils
GeckoEditable
JellybeanAsynCodec
MediaCodecUtil
Sonic
Keywords: good-first-bug
OS: Unspecified → Android
Priority: -- → P5
Hi. I'm new to open source development. I would like to take on this issue.
Hi Chaitanya, welcome!

Absolutely, I'll assign this to you.

You can find some docs on building Firefox for Android here: (this will build GeckoView too)

https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Build_Instructions/Simple_Firefox_for_Android_build

Feel free to ask me any question you might have here if you need help or clarification.
Assignee: nobody → bchaitanya15
Mentor: agi
Product: Firefox for Android → GeckoView
Should I go for artifact mode or the full mode? I am following the tutorial you provided.
I have made the necessary changes. Do I have to make an account on Phabricator and submit for code review there or something else? How should I proceed further?
Flags: needinfo?(agi)
Attachment #9033128 - Attachment is obsolete: true
Attachment #9033127 - Attachment is obsolete: true
Attachment #9033126 - Attachment is obsolete: true
Sorry for being late here! I was on PTO.

We use Phabricator for our review requests and I see you submitted your patch there, thank you!

You probably want a full build.
Flags: needinfo?(agi)
How do I do that?
Flags: needinfo?(agi)
I will make the changes that you have mentioned in 2 days.
(In reply to Chaitanya Bankanhal from comment #10)
> How do I do that?

Make a full build? Choose "4. Firefox for Android" when running |mach bootstrap| following the guide I linked in Comment #2
Flags: needinfo?(agi)
Okay. Got it
I am not able to complete a full build due to the following error:

1:15.24    Compiling baldrdash v0.1.0 (/home/negative0/Projects/mozilla-full/mozilla-central/js/src/wasm/cranelift)
 1:28.01 error: failed to run custom build command for `baldrdash v0.1.0 (/home/negative0/Projects/mozilla-full/mozilla-central/js/src/wasm/cranelift)`
 1:28.01 process didn't exit successfully: `/home/negative0/Projects/mozilla-full/mozilla-central/objdir-droid/release/build/baldrdash-f2fb86cd69a612fd/build-script-build` (exit code: 101)
 1:28.01 --- stdout
 1:28.01 cargo:rerun-if-changed=baldrapi.h
 1:28.02 cargo:rerun-if-changed=/home/negative0/Projects/mozilla-full/mozilla-central/objdir-droid/js/src/rust/extra-bindgen-flags
 1:28.02 --- stderr
 1:28.02 /home/negative0/.mozbuild/android-ndk-r18b/sources/cxx-stl/llvm-libc++/include/stddef.h:46:15: fatal error: 'stddef.h' file not found
 1:28.02 /home/negative0/.mozbuild/android-ndk-r18b/sources/cxx-stl/llvm-libc++/include/stddef.h:46:15: fatal error: 'stddef.h' file not found, err: true
 1:28.02 thread 'main' panicked at 'Unable to generate baldrapi.h bindings: ()', libcore/result.rs:1009:5
 1:28.02 stack backtrace:
 1:28.02    0:     0x7fd9cc72d95f - std::sys::unix::backtrace::tracing::imp::unwind_backtrace::h1fd4e34c3d03ef64
 1:28.02                                at libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
 1:28.02    1:     0x7fd9cc7128e7 - std::sys_common::backtrace::print::h714a469856413294
 1:28.02                                at libstd/sys_common/backtrace.rs:71
 1:28.02                                at libstd/sys_common/backtrace.rs:59
 1:28.02    2:     0x7fd9cc738d2f - std::panicking::default_hook::{{closure}}::h46fe49f863fa9721
 1:28.02                                at libstd/panicking.rs:211
 1:28.02    3:     0x7fd9cc738a94 - std::panicking::default_hook::h12f83bcd26b03624
 1:28.02                                at libstd/panicking.rs:227
 1:28.02    4:     0x7fd9cc7394ce - std::panicking::rust_panic_with_hook::hde420d6fd4455550
 1:28.02                                at libstd/panicking.rs:476
 1:28.02    5:     0x7fd9cc739071 - std::panicking::continue_panic_fmt::h8f394f3c578bcc76
 1:28.02                                at libstd/panicking.rs:390
 1:28.02    6:     0x7fd9cc738f55 - rust_begin_unwind
 1:28.02                                at libstd/panicking.rs:325
 1:28.02    7:     0x7fd9cc79ae1c - core::panicking::panic_fmt::hca5dc4e8b320bc56
 1:28.02                                at libcore/panicking.rs:77
 1:28.02    8:     0x55e83daaa069 - core::result::unwrap_failed::hd1a9ba068400b8d1
 1:28.02    9:     0x55e83daa9529 - build_script_build::main::h26020d0e34601a2e
 1:28.02   10:     0x55e83daa9de2 - std::rt::lang_start::{{closure}}::h14726ce6ca626d8c
 1:28.02   11:     0x7fd9cc738ef2 - std::panicking::try::do_call::h8c0dbb48abbdf4df
 1:28.02                                at libstd/rt.rs:59
 1:28.02                                at libstd/panicking.rs:310
 1:28.02   12:     0x7fd9cc746859 - __rust_maybe_catch_panic
 1:28.02                                at libpanic_unwind/lib.rs:102
 1:28.02   13:     0x7fd9cc6febaa - std::rt::lang_start_internal::h5b2de3cc38c3b406
 1:28.02                                at libstd/panicking.rs:289
 1:28.02                                at libstd/panic.rs:392
 1:28.02                                at libstd/rt.rs:58
 1:28.02   14:     0x55e83daa9dd0 - std::rt::lang_start::h1a03cd47e0ebf89c
 1:28.02   15:     0x7fd9cbce0a86 - __libc_start_main
 1:28.02   16:     0x55e83daa35f9 - _start
 1:28.02   17:                0x0 - <unknown>
 1:28.02 make[4]: *** [/home/negative0/Projects/mozilla-full/mozilla-central/config/rules.mk:1040: force-cargo-library-build] Error 101
 1:28.02 make[3]: *** [/home/negative0/Projects/mozilla-full/mozilla-central/config/recurse.mk:74: js/src/rust/target] Error 2
 1:28.02 make[3]: *** Waiting for unfinished jobs....
 1:28.06     Finished release [optimized] target(s) in 20.42s
 1:30.07    Compiling xpcom v0.1.0 (/home/negative0/Projects/mozilla-full/mozilla-central/xpcom/rust/xpcom)
 2:26.65    Compiling rsdparsa_capi v0.1.0 (/home/negative0/Projects/mozilla-full/mozilla-central/media/webrtc/signaling/src/sdp/rsdparsa_capi)
 2:31.65    Compiling netwerk_helper v0.0.1 (/home/negative0/Projects/mozilla-full/mozilla-central/netwerk/base/rust-helper)
 2:32.68    Compiling encoding_glue v0.1.0 (/home/negative0/Projects/mozilla-full/mozilla-central/intl/encoding_glue)
 2:34.89    Compiling mozurl v0.0.1 (/home/negative0/Projects/mozilla-full/mozilla-central/netwerk/base/mozurl)
 2:37.01    Compiling baldrdash v0.1.0 (/home/negative0/Projects/mozilla-full/mozilla-central/js/src/wasm/cranelift)
 2:37.20 error: failed to run custom build command for `baldrdash v0.1.0 (/home/negative0/Projects/mozilla-full/mozilla-central/js/src/wasm/cranelift)`
 2:37.20 process didn't exit successfully: `/home/negative0/Projects/mozilla-full/mozilla-central/objdir-droid/release/build/baldrdash-f2fb86cd69a612fd/build-script-build` (exit code: 101)
 2:37.20 --- stdout
 2:37.20 cargo:rerun-if-changed=baldrapi.h
 2:37.21 cargo:rerun-if-changed=/home/negative0/Projects/mozilla-full/mozilla-central/objdir-droid/js/src/rust/extra-bindgen-flags
 2:37.21 --- stderr
 2:37.21 /home/negative0/.mozbuild/android-ndk-r18b/sources/cxx-stl/llvm-libc++/include/stddef.h:46:15: fatal error: 'stddef.h' file not found
 2:37.21 /home/negative0/.mozbuild/android-ndk-r18b/sources/cxx-stl/llvm-libc++/include/stddef.h:46:15: fatal error: 'stddef.h' file not found, err: true
 2:37.21 thread 'main' panicked at 'Unable to generate baldrapi.h bindings: ()', libcore/result.rs:1009:5
 2:37.21 stack backtrace:
 2:37.21    0:     0x7fc96ca9f95f - std::sys::unix::backtrace::tracing::imp::unwind_backtrace::h1fd4e34c3d03ef64
 2:37.21                                at libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
 2:37.21    1:     0x7fc96ca848e7 - std::sys_common::backtrace::print::h714a469856413294
 2:37.21                                at libstd/sys_common/backtrace.rs:71
 2:37.21                                at libstd/sys_common/backtrace.rs:59
 2:37.21    2:     0x7fc96caaad2f - std::panicking::default_hook::{{closure}}::h46fe49f863fa9721
 2:37.21                                at libstd/panicking.rs:211
 2:37.21    3:     0x7fc96caaaa94 - std::panicking::default_hook::h12f83bcd26b03624
 2:37.21                                at libstd/panicking.rs:227
 2:37.22    4:     0x7fc96caab4ce - std::panicking::rust_panic_with_hook::hde420d6fd4455550
 2:37.23                                at libstd/panicking.rs:476
 2:37.23    5:     0x7fc96caab071 - std::panicking::continue_panic_fmt::h8f394f3c578bcc76
 2:37.25                                at libstd/panicking.rs:390
 2:37.25    6:     0x7fc96caaaf55 - rust_begin_unwind
 2:37.25                                at libstd/panicking.rs:325
 2:37.25    7:     0x7fc96cb0ce1c - core::panicking::panic_fmt::hca5dc4e8b320bc56
 2:37.25                                at libcore/panicking.rs:77
 2:37.25    8:     0x5588842a2069 - core::result::unwrap_failed::hd1a9ba068400b8d1
 2:37.25    9:     0x5588842a1529 - build_script_build::main::h26020d0e34601a2e
 2:37.25   10:     0x5588842a1de2 - std::rt::lang_start::{{closure}}::h14726ce6ca626d8c
 2:37.25   11:     0x7fc96caaaef2 - std::panicking::try::do_call::h8c0dbb48abbdf4df
 2:37.25                                at libstd/rt.rs:59
 2:37.25                                at libstd/panicking.rs:310
 2:37.25   12:     0x7fc96cab8859 - __rust_maybe_catch_panic
 2:37.25                                at libpanic_unwind/lib.rs:102
 2:37.25   13:     0x7fc96ca70baa - std::rt::lang_start_internal::h5b2de3cc38c3b406
 2:37.25                                at libstd/panicking.rs:289
 2:37.25                                at libstd/panic.rs:392
 2:37.26                                at libstd/rt.rs:58
 2:37.26   14:     0x5588842a1dd0 - std::rt::lang_start::h1a03cd47e0ebf89c
 2:37.26   15:     0x7fc96c052a86 - __libc_start_main
 2:37.26   16:     0x55888429b5f9 - _start
 2:37.26   17:                0x0 - <unknown>
 2:37.26 make[4]: *** [/home/negative0/Projects/mozilla-full/mozilla-central/config/rules.mk:1040: force-cargo-library-build] Error 101

Are you on Mac OSX? It looks like you might have encountered Bug 1495672. You should be able to run the following to fix it

open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg

I am not running mac os, I am running Debian Linux.

I have tried a few times, to redownload the repo and changing things here and there. but nothing seems to be working.

Flags: needinfo?(agi)

/home/negative0/.mozbuild/android-ndk-r18b/sources/cxx-stl/llvm-libc++/include/stddef.h:46:15: fatal error: 'stddef.h' file not found

This error message in your log points to a problem. The compiler can't find the stddef.h header file. The question is: what can't the compiler find the file?

Can you share the contents of your mozconfig (or .mozconfig) file in this bug? This file should be in your mozilla-central directory. When you run mach bootstrap, it prints some variables that need to be copied to your mozconfig file.

If you've changed your mozconfig file, you might need to rm -rf your objdir directory, in case there is some old include paths in a file there.

Flags: needinfo?(agi)

Hi, Is this still up for grabs? I would like to work on this bug.

Flags: needinfo?(agi)

Hi, I've submitted a patch in Phabricator with a comment with an explanation. Please take a look, thanks!

Responded on phabricator.

Flags: needinfo?(agi)

This good-first-bug hasn't had any activity for 2 months, it is automatically unassigned.
For more information, please visit auto_nag documentation.

Assignee: bchaitanya15 → nobody
Severity: normal → S3
Assignee: nobody → loganrosen
Status: NEW → ASSIGNED

This good-first-bug hasn't had any activity for 2 months, it is automatically unassigned.
For more information, please visit BugBot documentation.

Assignee: loganrosen → nobody
Status: ASSIGNED → NEW
Assignee: nobody → loganrosen
Status: NEW → ASSIGNED
Pushed by archaeopteryx@coole-files.de:
https://hg.mozilla.org/integration/autoland/rev/77bbb01dbe90
simplify redundant if statements r=geckoview-reviewers,owlish
Status: ASSIGNED → RESOLVED
Closed: 6 months ago
Resolution: --- → FIXED
Target Milestone: --- → 121 Branch
Attachment #9246208 - Attachment is obsolete: true
Attachment #9033129 - Attachment is obsolete: true

No need to uplift to Beta 120.

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: