Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use of unnecessary "^ true" for boolean expressions #409

Closed
bagipro opened this issue Dec 10, 2018 · 0 comments
Closed

Use of unnecessary "^ true" for boolean expressions #409

bagipro opened this issue Dec 10, 2018 · 0 comments

Comments

@bagipro
Copy link
Collaborator

bagipro commented Dec 10, 2018

Hi,
I've noticed that thing in master and type-inference-wip branches. For example
com.paypal.android.p2pmobile.wallet.banksandcards.utils.EnterCardFragmentUtils

    public static boolean isCardCSCValid(@android.support.annotation.Nullable com.paypal.android.foundation.wallet.model.FinancialInstrumentMetadataDefinition financialInstrumentMetadataDefinition, java.lang.String str) {
        boolean z = false;
        if (financialInstrumentMetadataDefinition == null) {
            return false;
        }
        com.paypal.android.foundation.wallet.model.FinancialInstrumentMetadataAttribute cvv = financialInstrumentMetadataDefinition.getCvv();
        if (cvv == null) {
            return true;
        }
        if (android.text.TextUtils.isEmpty(str)) {
            return cvv.isRequired() ^ true; // <<<
        }

It seems that booleanExpr ^ true is useless and can be removed, but booleanExpr ^ false could be replaced with !booleanExpr

APK: https://drive.google.com/open?id=1pdmRyrp6rDEoYsTJn5RLhv39xXRq5Ksh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant