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

BootstrapMethods attribute cannot be empty

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 8
    • Fix Version/s: 9
    • Component/s: hotspot
    • Subcomponent:
    • Resolved In Build:
      b15
    • CPU:
      x86_64
    • OS:
      linux

      Backports

        Description

        FULL PRODUCT VERSION :
        java version "1.8.0_05"
        Java(TM) SE Runtime Environment (build 1.8.0_05-b13)
        Java HotSpot(TM) 64-Bit Server VM (build 25.5-b02, mixed mode)

        FULL OS VERSION :
        Linux master.site 3.1.10-1.29-desktop #1 SMP PREEMPT Fri May 31 20:10:04 UTC 2013 (2529847) x86_64 x86_64 x86_64 GNU/Linux

        A DESCRIPTION OF THE PROBLEM :
        Since the update 5 of java 8 (the initial release of the Java 8 VM did not show the in question behaviour) the VM does not allow BootstrapMethods attributes to be empty, e.g. num_bootstrap_methods to be 0. The Documentation of the Java 7 VM and Java 8 VM do not clearly state an empty BootstrapMethods attribute to be an error.


        THE PROBLEM WAS REPRODUCIBLE WITH -Xint FLAG: Yes

        THE PROBLEM WAS REPRODUCIBLE WITH -server FLAG: Yes

        REGRESSION. Last worked in version 7u55

        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        Create a class file (version 51.0) with an empty BootstrapMethods attribute and let it be loaded by the VM.

        EXPECTED VERSUS ACTUAL BEHAVIOR :
        The VM accepting an empty BootstrapMethods attribute.
        ERROR MESSAGES/STACK TRACES THAT OCCUR :
        java.lang.ClassFormatError: Invalid BootstrapMethods attribute length 2 in class file Fibo
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:760)
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
        at java.net.URLClassLoader.defineClass(URLClassLoader.java:455)
        at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:367)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
        at teajay.runtime.TypeManager.putTypes(TypeManager.java:199)
        at teajay.runtime.TypeManager.putTypes(TypeManager.java:175)
        at teajay.runtime.TypeManager$TypeFinder.visit(TypeManager.java:43)
        at teajay.util.io.FileIterator.scanFile(FileIterator.java:199)
        at teajay.util.io.FileIterator.scan(FileIterator.java:132)
        at teajay.util.io.FileIterator.scan(FileIterator.java:110)
        at teajay.runtime.TypeManager.<init>(TypeManager.java:112)
        at teajay.runtime.TypeManager.instance(TypeManager.java:241)
        at teajay.runtime.Run$2.run(Run.java:225)
        at java.lang.Thread.run(Thread.java:745)

        REPRODUCIBILITY :
        This bug can be reproduced always.

        ---------- BEGIN SOURCE ----------
        The example was not generated by a java compiler.
        ---------- END SOURCE ----------

        CUSTOMER SUBMITTED WORKAROUND :
        suppress the creation of empty BootstrapMethods attributes.

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                lfoltan Lois Foltan
                Reporter:
                webbuggrp Webbug Group
                Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved: