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

javac-generated code doesn't obey binary compatibility for enums

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P2
    • Resolution: Fixed
    • Affects Version/s: 5.0
    • Fix Version/s: 5.0
    • Component/s: tools
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      b56
    • CPU:
      generic
    • OS:
      solaris_8

      Description

      First compile this:

          enum Color {
              red, green
          }

          class Main {
              static int f(Color c) {
                  switch(c) {
                  case green:
                      return 2;
                  case red:
                      return 1;
                  default:
                      return 0;
                  }
              }

              public static void main(String[] args) {
                  f(Color.red);
              }
          }

      and then this:

          enum Color {
              red
          }

      and then run Main. The binary compatibility rules for enums require
      the program to execute to completion with no exceptions, but the current
      implementation using chained if statements does not do that.

        Attachments

          Activity

            People

            • Assignee:
              gafter Neal Gafter
              Reporter:
              gafter Neal Gafter
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Imported:
                Indexed: