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

JShell: StackTraceElement#getFileName of EvalException does not use custom id generator

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 9
    • 9
    • tools
    • None
    • b135
    • generic
    • generic
    • Verified

      StackTraceElement#getFileName of EvalException/UnresolvedException does not retrieve ids from custom id generators.

      Code to reproduce:
       JShell.Builder builder = JShell.builder().idGenerator(((snippet, id) -> "custom" + id));
       try (JShell jShell = builder.build()) {
           EvalException evalException = (EvalException) jShell.eval("throw new Error();").get(0).exception();
           for (StackTraceElement ste : evalException.getStackTrace()) {
               assertTrue(ste.getFileName().startsWith("custom"), "Not started with \"custom\": " + ste.getFileName());
           }
       }

      Regression test: IdGeneratorTest#testIdInException.

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

              Created:
              Updated:
              Resolved: