Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8187430

Parser fails to handle constant patterns involving enums

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Withdrawn
    • Affects Version/s: None
    • Fix Version/s: repo-amber
    • Component/s: tools
    • Labels:
    • Subcomponent:
    • CPU:
      generic
    • OS:
      generic

      Description

      This program fails to compile:

      import java.util.ArrayList;

      enum Day {
          Sunday,
          Monday,
          Tuesday
      };

      public class X {
          public static void main(String [] args) {
              Day day = null;
              
              switch (day) {
                  case Sunday: break;
                  case Monday: break;
              }

              if (day __matches Sunday) {
                  System.out.println("Blah");
              }
          }
      }

      X.java:18: error: cannot find symbol
              if (day __matches Sunday) {
                                ^
        symbol: variable Sunday
        location: class X
      1 error

        Attachments

          Activity

            People

            Assignee:
            gbierman Gavin Bierman
            Reporter:
            sadayapalam Srikanth Adayapalam
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: