Skip to content

refundant nullcheck of value known to non-null #1231

Closed

Description

@hqq2023623

There are some "refundant nullcheck of value known to non-null" suggests can be found by findBugs plugin, maybe we should handle these to make the code cleaner
example : CacheFilter#invoke , check the (cache != null) twice

Activity

  1. ralf0131 commented on Jan 18, 2018

    @ralf0131
    Contributor

    Hi, could you provide more details (file name, line number for example)?

  2. hqq2023623 commented on Jan 18, 2018

    @hqq2023623
    ContributorAuthor

    type1 : check null more than one time

    FutureFilter#fireInvokeCallback

    line 110 , onInvokeMethod is checked by line 107
    1

    the same as FutureFilter#fireReturnCallback

    2

    ### and FutureFilter#fireThrowCallback

    3

    type2 : checked by context

    MergeableClusterInvoker#invoke ,at line 144

    4

    returnType.getMethod() will not return null

    5

    JavaBeanDescriptor#getEnumPropertyName , at line 141

    6

    if getProperty() return null , then toString() may throw NPE before the result == null check
  3. hqq2023623 commented on Jan 18, 2018

    @hqq2023623
    ContributorAuthor

    type3 : call method that never return null

    ###ExtensionLoader#hasExtension , at line 333
    7
    ExtensionLoader#getExtensionClass() never return null
    8

  4. hqq2023623 commented on Jan 18, 2018

    @hqq2023623
    ContributorAuthor

    type4 : check by both caller and self

    caller : RegistryDirectory#notify , at line 207

    1

    self : RegistryDirectory#toRouters , at line 309

    2

  5. hqq2023623 commented on Jan 19, 2018

    @hqq2023623
    ContributorAuthor
  6. ralf0131 commented on Jan 19, 2018

    @ralf0131
    Contributor

    Hi @hqq2023623 Thanks for pointing out. It will be really appreciate if you can create a pull request~

  7. added a commit that references this issue on Jan 19, 2018
    ade85fe
  8. chickenlj commented on Jan 25, 2018

    @chickenlj
    Contributor

    Thanks, i will review the PR laterly.

  9. added a commit that references this issue on Feb 24, 2018
    4bbc0dd
  10. added 3 commits that reference this issue on Feb 26, 2018
    0d7dfaa
    125e6a1
    a3b8d73
  11. added a commit that references this issue on Sep 9, 2019
    f05b8eb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions