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

Record Deconstruction causes bytecode error

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 21
    • None
    • tools
    • None
    • b17

      public class Test {
          record Foo(Object first, Object second) {}

          public static void main(String[] args) {
              Foo myfoo = new Foo(42, "millis");

              switch (myfoo) {
                  case Foo(Integer d, String s) -> System.out.println("got integer and string: " + d + ", " + s);
                  case Foo(Object fs, Object sc) -> System.out.println("values: " + fs + ", " + sc);
              }
          }
      }

            jlahoda Jan Lahoda
            abimpoudis Angelos Bimpoudis
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: