Uploaded image for project: 'HBase'
  1. HBase
  2. HBASE-23093

Avoid Optional Anti-Pattern where possible

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.0.0, 2.3.0, 1.6.0
    • Fix Version/s: 3.0.0, 2.3.0, 2.2.2, 2.1.8
    • Component/s: None
    • Labels:
      None
    • Hadoop Flags:
      Reviewed

      Description

      Optional should be used as a return type only. It's a neat solution for handling data that might  not be present. We should avoid using Optional Anti-Patterns i.e. using it as a field or parameter type due to these reasons:

      1. Using Optional parameters causing conditional logic inside the methods is not productive.

      2. Packing an argument in an Optional is suboptimal for the compiler and does an unnecessary wrapping.

      3. Optional field is not serializable.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                vjasani Viraj Jasani
                Reporter:
                vjasani Viraj Jasani
              • Votes:
                0 Vote for this issue
                Watchers:
                7 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: