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

Deconstruction pattern matching causing runtime exception

XMLWordPrintable

    • generic
    • generic

      ADDITIONAL SYSTEM INFORMATION :
      openjdk version "19-ea" 2022-09-20
      OpenJDK Runtime Environment (build 19-ea+25-1892)
      OpenJDK 64-Bit Server VM (build 19-ea+25-1892, mixed mode, sharing)


      A DESCRIPTION OF THE PROBLEM :
      Code that compiles correctly with JDK 19 throws an exception at runtime:

      Error: LinkageError occurred while loading main class examples.SimpleInterpreter
      java.lang.ClassFormatError: Method $proxy$a in class examples/SimpleInterpreter has illegal modifiers: 0x1008

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      In terminal that has Java 19 EA, Maven and git:

      - git clone https://github.com/Randgalt/expressive-java.git
      - cd expressive-java
      - git checkout jordanz/java19
      - cd java-19
      - mvn package
      - java --enable-preview -cp target/classes examples.SimpleInterpreter

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Output some results
      ACTUAL -
      Error: LinkageError occurred while loading main class examples.SimpleInterpreter
      java.lang.ClassFormatError: Method $proxy$a in class examples/SimpleInterpreter has illegal modifiers: 0x1008


      ---------- BEGIN SOURCE ----------
      See steps to reproduce
      ---------- END SOURCE ----------

      FREQUENCY : always


            jlahoda Jan Lahoda
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: