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

ParameterNotNullable should detect null checks in commons-lang StringUtils #1044

Closed
zman0900 opened this issue Jun 2, 2018 · 0 comments · Fixed by #2084
Closed

ParameterNotNullable should detect null checks in commons-lang StringUtils #1044

zman0900 opened this issue Jun 2, 2018 · 0 comments · Fixed by #2084

Comments

@zman0900
Copy link

zman0900 commented Jun 2, 2018

What version of Error Prone are you using?

2.3.1

Does this issue reproduce with the latest release?

2.3.1 is latest

What did you do?

  • -Xep:ParameterNotNullable:WARN
import org.apache.commons.lang3.StringUtils;
import javax.annotation.Nullable;

public class MyClass {
    @Nullable
    public Character doTheThing(@Nullable final String str) {
        Character result = null;
        if (StringUtils.isNotEmpty(str)) {
            result = str.charAt(0);
        }
        return result;
    }
}

What did you expect to see?

No warning.

What did you see instead?

[ParameterNotNullable] Nullable parameter not checked for null.


It would be useful if ParameterNotNullable could detect the null checking that happens inside this call to StringUtils#isNotEmpty and other similar method inside commons-lang, or maybe even other libraries.

copybara-service bot pushed a commit that referenced this issue Jan 9, 2021
copybara-service bot pushed a commit that referenced this issue Jan 11, 2021
stevie400 pushed a commit to HubSpot/error-prone that referenced this issue Jan 15, 2021
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

Successfully merging a pull request may close this issue.

1 participant