JEP 136: Enhanced Verification Errors
Summary
Provide additional contextual information about bytecode-verification errors to ease diagnosis of bytecode or stackmap deficiencies in the field.
Goals
Bytecodes are verified by the JVM's bytecode verifier. Bytecodes emitted by the JDK's javac
compiler generally result in highly conformant bytecode. However, there are other tools and packages that modify bytecode for various reasons, including instrumentation and debugging. Occasionally, post-processing bytecode results in a VerifyError
. Currently, the message associated with the error is rather terse and non-specific. The purpose of this feature is to expand the information available when a VerifyError
occurs in modern classfiles so that a developer can more quickly resolve the problem.
Non-Goals
While additional data about errors can be provided, it is not the goal to provide "all possible" data about an error, especially in cases where additional data can be obtained by other means. For instance, while the actual bytecode where the problem occurs may be included in an error message, it may not be disassembled into human-readable form. Additionally the state of the system such as loaded classes and their relationships are not provided as this information is available using other mechanisms.
This extra data will only be available and displayed for errors that are generated by the type-checking verifier. Classfiles with a version less than 50 are verified using the inferencing verifier. Errors generated by the inferencing verifier will not change.
The format of the error message and it's data are not official nor fully specified, and are subject to change in any release.
Success Metrics
This project is considered successful if the additional data provided is used by any single engineer to diagnose a real verification error situation. Given the unpredictability of the problem, and the continuing resistance of engineers to allow implanted tracking chips in their brains, there really is no useful metric that can be applied in this case. We have to rely upon common sense and experience in determining what is likely to be useful, which is historically a notoriously hard thing to quantify.