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

JShell: user exception chained cause not retained

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P3
    • 11
    • 9, 10, 11
    • tools
    • b08
    • Verified

    Description

      If I evaluate an expression which results in throwing an exception, and that exception has a cause, the cause is not included in the stack trace:

      jshell> $8.resolveConstantRef(MethodHandles.lookup())
      | java.lang.BootstrapMethodError thrown: bootstrap method initialization exception
      | at BootstrapMethodInvoker.invoke (BootstrapMethodInvoker.java:174)
      | at ConstantBootstraps.makeConstant (ConstantBootstraps.java:66)
      | at DynamicConstantRef.resolveConstantRef (DynamicConstantRef.java:308)
      | at (#22:1)

      This exception had a chained cause, but it wasn't displayed. (Its pretty hard to debug the above without the underlying cause.)

      -----------

      The cause is not propagated at initial interception in the execution engine. This requires changes in the user code execution, the execution SPI, the representation of exceptions on the stream, the handling of evaluation, the JShell API, and the jshell tool.

      -----------

      The existing jshell tool display format for exceptions was not designed with chained exceptions in mind. It is not superior to that used by printStackTrace() and the JVM. Consistency with these is useful for transitioning. So, the jshell tool will use the standard format (which handles chained exceptions).

      Attachments

        Issue Links

          Activity

            People

              rfield Robert Field (Inactive)
              rfield Robert Field (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: