Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-12059

Remove redundant null checks from instanceof checks

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Trivial
    • Resolution: Fixed
    • Affects Version/s: 2.20.1
    • Fix Version/s: 2.21.0
    • Component/s: None
    • Labels:
      None
    • Estimated Complexity:
      Novice

      Description

      The null check in
      if (exchange.getFromEndpoint() != null && exchange.getFromEndpoint() instanceof DirectEndpoint)
      is redundant, this is equivalent to
      if (exchange.getFromEndpoint() instanceof DirectEndpoint)

      Basic use of IntelliJ Structural Search and Replace with:
      $Expr$ != null && $Expr$ instanceof $Type$
      finds (and can correct) dozens of examples

        Attachments

          Activity

            People

            • Assignee:
              acosentino Andrea Cosentino
              Reporter:
              drekbour Marc Carter
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: