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

java.lang.ClassFormatError: Illegal field name ""

XMLWordPrintable

    • generic
    • generic

      ADDITIONAL SYSTEM INFORMATION :
      Microsoft Windows [Version 10.0.19045.3570]

      A DESCRIPTION OF THE PROBLEM :
      Run the testcase. This issue is not reproducible in openjdk 22-ea+19-1460. If this was fixed in version 22, the fix probably needs to be backported to version 21.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. Compile the testcase using "javac -g --release 21 --enable-preview Test.java"
      2. Run "java --enable-preview Test"

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Exception in thread "main" java.lang.IllegalArgumentException: Not a number
              at Test.main(Test.java:10)
      ACTUAL -
      Error: LinkageError occurred while loading main class Test
              java.lang.ClassFormatError: Illegal field name "" in class Test

      ---------- BEGIN SOURCE ----------
      public class Test
      {
          public static void main(String[] args) {
              try
              {
                  System.out.println(Double.valueOf("not a number"));
              }
              catch (NumberFormatException _)
              {
                  throw new IllegalArgumentException("Not a number");
              }
          }
      }
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Compile classes without debug symbols (remove "-g")

      FREQUENCY : always


            adev Anupam Dev
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: