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

Move MissingSwitchDefault check from checkstyle to error-prone

VotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 3.0.0-alpha-1, 2.1.0
    • build
    • None

    Description

      Both checkstyle and error-prone can alert when a switch statement is missing a default. However, because checkstyle does it via static analysis and error-prone does it during compilation, e-p can detect when all cases of an enum have been covered, and will not warn about the needed default case.

      In fact, checkstyle explicitly mentions in their docs that even if you cover all enum cases now, you should still have a default label because the enum could change in the future. Which seems silly to me, because your analysis tools should still be running in the future and would catch it then.

      Se we should migrate the check from checkstyle to a slightly smarter error-prone check.

      Attachments

        1. HBASE-20707.patch
          6 kB
          Mike Drob

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            mdrob Mike Drob
            mdrob Mike Drob
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment