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

java.lang.ClassFormatError: Illegal field name "1" in class

    XMLWordPrintable

    Details

    • Subcomponent:
    • Understanding:
      Cause Known
    • CPU:
      x86_64
    • OS:
      windows_7

      Description

      ADDITIONAL SYSTEM INFORMATION :
      OS: Windows 7
      Classes compiled with the Microsoft Compiler (jvc, jdk 1.0).
      JRE: 8u261 (works), 8u281 (doesn't work).

      A DESCRIPTION OF THE PROBLEM :
      It would appear there has been some regression in how anonymous inner classes compiled using older JDK's are loaded in 8u281. Previously, using 8u261, this error would not appear. The following stacktrace is given when using 8u281:

      java.lang.ClassFormatError: Illegal field name "1" in class postilion/core/tranmgr/PerfMonManager$1
                      at java.lang.ClassLoader.defineClass1(Native Method)
                      at java.lang.ClassLoader.defineClass(ClassLoader.java:756)
                      at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
                      at java.net.URLClassLoader.defineClass(URLClassLoader.java:468)
                      at java.net.URLClassLoader.access$100(URLClassLoader.java:74)
                      at java.net.URLClassLoader$1.run(URLClassLoader.java:369)
                      at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
                      at java.security.AccessController.doPrivileged(Native Method)
                      at java.net.URLClassLoader.findClass(URLClassLoader.java:362)
                      at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
                      at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352)
                      at java.lang.ClassLoader.loadClass(ClassLoader.java:351)

      The class in question (PerfMonManager) has a static initialization block that adds a runtime shutdown hook, where the thread defining the shutdown hook is constructed as an anonymous inner class, ie.

      Runtime.getRuntime().addShutdownHook(
      new Thread("TranMgr PerfMonManager Cleanup")
      {
      public void run()
      {
      PerfMonManager.close();
      }
      });

      This anonymous class is compiled into PerfMonManager$1.class

      This is a legacy application that is compiled using the Microsoft Compiler (jvc). My best guess is that the byte-code from these anonymous inner classes, generated using an old JDK, can no longer be understood by the latest JRE. There is no mention in the release notes of anything that would have changed the way classes are loaded.

      Unfortunately, this is not the only case where anonymous inner classes are used in our code, and it is not feasible to update the application to not build against the Microsoft Compiler without substantial changes.

      Turning off the verifier (-Xverify:none) allows the application to start, but the consequences of this is unknown and definitely not something we can consider doing.

      REGRESSION : Last worked in version 8

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Define an anonymous inner class inside a main class, compiled using JVC, and attempt to execute the program using the latest 8u281.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The class should be loaded/executed successfully as in 8u261.
      ACTUAL -
      java.lang.ClassFormatError: Illegal field name "1" in class is thrown.

      FREQUENCY : always


        Attachments

        1. Capture1.PNG
          Capture1.PNG
          247 kB
        2. Capture2.PNG
          Capture2.PNG
          3 kB
        3. jre_bug_example.zip
          2 kB
        4. TestCaptue.PNG
          TestCaptue.PNG
          34 kB
        5. TestCaseApp.java
          0.2 kB

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

                Dates

                Created:
                Updated: