JDK-8041918 : BootstrapMethods attribute cannot be empty
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 8
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: linux
  • CPU: x86_64
  • Submitted: 2014-04-20
  • Updated: 2014-10-15
  • Resolved: 2014-05-15
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 7 JDK 8 JDK 9
7u76Fixed 8u20Fixed 9 b15Fixed
Related Reports
Relates :  
Relates :  
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.


Comments
Bugfix for overeager fix in 8041717. No spec change required.
18-09-2014

Both bugs deal with BootstrapMethods attribute handling in ClassFileParser.cpp
29-04-2014