JDK-8168937 : invokedynamic should always wrap exceptions in BootstrapMethodError
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.lang.invoke
  • Affected Version: 9
  • Priority: P2
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2016-10-31
  • Updated: 2017-08-09
  • Resolved: 2016-11-02
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 9
9Fixed
Related Reports
Relates :  
Description
vm/mlvm/cp/stress/classfmt/incorrectBootstrap is failing in the nightlies. The output below is from the log, it's unclear how much of this is provoked on purpose by the test and what caused the test to fail.

### TRACE 1: RNG seed = 9055436315270586682 (0x7dab5f59d9e0213a)
# ERROR: Test caught an exception: 
# ERROR: java.lang.RuntimeException: invokedynamic should always wrap exceptions in BootstrapMethodError!
# ERROR: 	at Dummy.test00(Unknown Source)
# ERROR: 	at Dummy.main(Unknown Source)
# ERROR: 	at java.lang.invoke.MethodHandle.invokeWithArguments(java.base@9-internal/MethodHandle.java:637)
# ERROR: 	at java.lang.invoke.MethodHandle.invokeWithArguments(java.base@9-internal/MethodHandle.java:659)
# ERROR: 	at vm.mlvm.share.ClassfileGeneratorTest.run(ClassfileGeneratorTest.java:66)
# ERROR: 	at vm.mlvm.share.MlvmTestExecutor.runMlvmTestInstance(MlvmTestExecutor.java:361)
# ERROR: 	at vm.mlvm.share.MlvmTestExecutor.runMlvmTest(MlvmTestExecutor.java:305)
# ERROR: 	at vm.mlvm.share.MlvmTestExecutor.launch(MlvmTestExecutor.java:222)
# ERROR: 	at vm.mlvm.share.MlvmTestExecutor.launch(MlvmTestExecutor.java:164)
# ERROR: 	at vm.mlvm.share.MlvmTestExecutor.launch(MlvmTestExecutor.java:135)
# ERROR: 	at vm.mlvm.share.MlvmTest.launch(MlvmTest.java:312)
# ERROR: 	at vm.mlvm.share.ClassfileGeneratorTest.main(ClassfileGeneratorTest.java:72)
# ERROR: Caused by: java.lang.IncompatibleClassChangeError: Inconsistent constant pool data in classfile for class Dummy. Method bootstrapInstance(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite; at index 93 is CONSTANT_InterfaceMethodRef and should be CONSTANT_MethodRef
# ERROR: 	... 12 more
The following stacktrace is for Aurora. Used to create a RULE:
nsk.share.TestFailure: Test caught an exception:  java.lang.RuntimeException: invokedynamic should always wrap exceptions in BootstrapMethodError!
	at nsk.share.Log.logExceptionForAurora(Log.java:411)
	at nsk.share.Log.complain(Log.java:380)
	at nsk.share.Log.complain(Log.java:391)
	at vm.mlvm.share.Env.complain(Env.java:150)
	at vm.mlvm.share.MlvmTestExecutor.launch(MlvmTestExecutor.java:224)
	at vm.mlvm.share.MlvmTestExecutor.launch(MlvmTestExecutor.java:164)
	at vm.mlvm.share.MlvmTestExecutor.launch(MlvmTestExecutor.java:135)
	at vm.mlvm.share.MlvmTest.launch(MlvmTest.java:312)
	at vm.mlvm.share.ClassfileGeneratorTest.main(ClassfileGeneratorTest.java:72)
### TRACE 1: TEST FAILED


#>  
#>  SUMMARY: Following errors occured
#>      during test execution:
#>  
# ERROR: Test caught an exception: 
# ERROR: java.lang.RuntimeException: invokedynamic should always wrap exceptions in BootstrapMethodError!
# ERROR: 	at Dummy.test00(Unknown Source)
# ERROR: 	at Dummy.main(Unknown Source)
# ERROR: 	at java.lang.invoke.MethodHandle.invokeWithArguments(java.base@9-internal/MethodHandle.java:637)
# ERROR: 	at java.lang.invoke.MethodHandle.invokeWithArguments(java.base@9-internal/MethodHandle.java:659)
# ERROR: 	at vm.mlvm.share.ClassfileGeneratorTest.run(ClassfileGeneratorTest.java:66)
# ERROR: 	at vm.mlvm.share.MlvmTestExecutor.runMlvmTestInstance(MlvmTestExecutor.java:361)
# ERROR: 	at vm.mlvm.share.MlvmTestExecutor.runMlvmTest(MlvmTestExecutor.java:305)
# ERROR: 	at vm.mlvm.share.MlvmTestExecutor.launch(MlvmTestExecutor.java:222)
# ERROR: 	at vm.mlvm.share.MlvmTestExecutor.launch(MlvmTestExecutor.java:164)
# ERROR: 	at vm.mlvm.share.MlvmTestExecutor.launch(MlvmTestExecutor.java:135)
# ERROR: 	at vm.mlvm.share.MlvmTest.launch(MlvmTest.java:312)
# ERROR: 	at vm.mlvm.share.ClassfileGeneratorTest.main(ClassfileGeneratorTest.java:72)
# ERROR: Caused by: java.lang.IncompatibleClassChangeError: Inconsistent constant pool data in classfile for class Dummy. Method bootstrapInstance(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite; at index 93 is CONSTANT_InterfaceMethodRef and should be CONSTANT_MethodRef
# ERROR: 	... 12 more
Comments
The test needs updating after the spec change re BootstrapMethodError. This is not an integration blocker. Fix needed in GenManyIndyIncorrectBootstrap.java in vm-testbase.
01-11-2016

Moving to core-libs/java.lang.invoke. Actually, this looks related to JDK-8166974 and the failure first showed up after the fix was pushed. [~psandoz], could you please have a look?
31-10-2016