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

Remove redundant null checks from instanceof checks

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Trivial
    • Resolution: Fixed
    • 2.20.1
    • 2.21.0
    • None
    • None
    • 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

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

            Dates

              Created:
              Updated:
              Resolved: