Derby
  1. Derby
  2. DERBY-5077

[patch] remove non productive instanceof checks

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Trivial Trivial
    • Resolution: Fixed
    • Affects Version/s: 10.7.1.1
    • Fix Version/s: 10.9.1.0
    • Component/s: SQL, Store
    • Labels:
      None
    • Urgency:
      Low

      Description

      various places in code does instanceof checks where the outcome can be determined statically to be always true or always false.

      removed these checks as they do nothing.

        Activity

        Dave Brosius created issue -
        Dave Brosius made changes -
        Field Original Value New Value
        Attachment remove_useless_instanceofs.diff [ 12472281 ]
        Hide
        Knut Anders Hatlen added a comment -

        Note that instanceof checks return false if the object is null, even if the statically known type matches the type in the check. So unless we know that the object is non-null, simply removing the check isn't safe. I haven't checked if that's a problem in the code that's touched by the patch, but thought I'd raise the issue.

        Show
        Knut Anders Hatlen added a comment - Note that instanceof checks return false if the object is null, even if the statically known type matches the type in the check. So unless we know that the object is non-null, simply removing the check isn't safe. I haven't checked if that's a problem in the code that's touched by the patch, but thought I'd raise the issue.
        Hide
        Dave Brosius added a comment -

        good point, i'll take a look and resubmit

        Show
        Dave Brosius added a comment - good point, i'll take a look and resubmit
        Dave Brosius made changes -
        Attachment remove_useless_instanceofs.diff [ 12472281 ]
        Hide
        Dave Brosius added a comment -

        determined the places where instanceof checks might detect null values, and replace with null checking. The rest of the places the instanceof was removed.

        Show
        Dave Brosius added a comment - determined the places where instanceof checks might detect null values, and replace with null checking. The rest of the places the instanceof was removed.
        Dave Brosius made changes -
        Attachment remove_useless_instanceofs.diff [ 12472505 ]
        Rick Hillegas made changes -
        Fix Version/s 10.8.1.1 [ 12316356 ]
        Fix Version/s 10.8.1.0 [ 12315561 ]
        Rick Hillegas made changes -
        Fix Version/s 10.8.1.2 [ 12316362 ]
        Fix Version/s 10.8.1.1 [ 12316356 ]
        Rick Hillegas made changes -
        Fix Version/s 10.8.1.3 [ 12316378 ]
        Fix Version/s 10.8.1.2 [ 12316362 ]
        Rick Hillegas made changes -
        Fix Version/s 10.8.1.4 [ 12316500 ]
        Fix Version/s 10.8.1.3 [ 12316378 ]
        Knut Anders Hatlen made changes -
        Fix Version/s 10.8.1.5 [ 12316676 ]
        Fix Version/s 10.8.1.4 [ 12316500 ]
        Hide
        Kristian Waagan added a comment -

        Attaching patch 1a, which is the original patch with some additional changes:
        o removed one more instanceof in SubqueryNode
        o made checkColumnOrdering in MergeSort private and rewrote the comment. Still not sure if checking if the column is null adds value, but keeping it is no big deal (the method is only called from a sanity block)
        o merged two SanityManager.DEBUG blocks.

        Running the tests, will commit if they pass.

        Show
        Kristian Waagan added a comment - Attaching patch 1a, which is the original patch with some additional changes: o removed one more instanceof in SubqueryNode o made checkColumnOrdering in MergeSort private and rewrote the comment. Still not sure if checking if the column is null adds value, but keeping it is no big deal (the method is only called from a sanity block) o merged two SanityManager.DEBUG blocks. Running the tests, will commit if they pass.
        Kristian Waagan made changes -
        Hide
        Kristian Waagan added a comment -

        Committed to trunk with revision 1145926.

        Show
        Kristian Waagan added a comment - Committed to trunk with revision 1145926.
        Kristian Waagan made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Issue & fix info [Patch Available]
        Assignee Kristian Waagan [ kristwaa ]
        Fix Version/s 10.9.0.0 [ 12316344 ]
        Fix Version/s 10.8.1.6 [ 12316676 ]
        Resolution Fixed [ 1 ]
        Kristian Waagan made changes -
        Component/s SQL [ 11408 ]
        Component/s Store [ 11412 ]
        Component/s Network Server [ 11410 ]
        Hide
        Knut Anders Hatlen added a comment -

        [bulk update] Close all resolved issues that haven't been updated for more than one year.

        Show
        Knut Anders Hatlen added a comment - [bulk update] Close all resolved issues that haven't been updated for more than one year.
        Knut Anders Hatlen made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Gavin made changes -
        Workflow jira [ 12600285 ] Default workflow, editable Closed status [ 12802795 ]
        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open Resolved Resolved
        134d 2h 55m 1 Kristian Waagan 13/Jul/11 10:20
        Resolved Resolved Closed Closed
        704d 23h 58m 1 Knut Anders Hatlen 17/Jun/13 10:19

          People

          • Assignee:
            Kristian Waagan
            Reporter:
            Dave Brosius
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Time Tracking

              Estimated:
              Original Estimate - 1h
              1h
              Remaining:
              Remaining Estimate - 1h
              1h
              Logged:
              Time Spent - Not Specified
              Not Specified

                Development