Uploaded image for project: 'NetBeans'
  1. NetBeans
  2. NETBEANS-1677

Proposed suggestion hint to prevent RuntimeException "error: the switch expression does not cover all possible input values."

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Not A Problem
    • None
    • None
    • None

    Description

      enum Days

      { SUNDAY, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY; }

      public static void demonstrateLackingCaseInSwitchExpression() 
      {

      int numLetters = switch (day) {
      case MONDAY, SUNDAY ->

      { break 6; }

      case TUESDAY -> 7;
      case THURSDAY, SATURDAY -> 8;
      case WEDNESDAY -> 9;
      };
      }

      Runtime Exception :" the switch expression does not cover all possible input values."

      Proposed new hint should  prevent this situation, it should suggest user if he/she missed to add default case or any enum value case.

       

      Attachments

        Activity

          People

            sakeshar Sarvesh Kesharwani
            arunava.sinha ARUNAVA SINHA
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: