doc: JShell snippet doesn't compile

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: P4
    • 17
    • Affects Version/s: 15
    • Component/s: tools
    • None
    • b14

      The example snippet in the `jdk.shell` javadoc (*) doesn't compile as it tries to access private fields in `jdk.jshell.SnippetEvent`. Using accessors methods instead will make the code compile.

      `e.causeSnippet` -> `e.causeSnippet()`
      `e.status -> `e.status()`
      `e.previousStatus` -> `e.previousStatus()`
      `e.value` -> `e.value()`
      `e.snippet.source` -> `e.snippet.source()`

      PS: `import java.io.ByteArrayInputStream;`seems unneeded.

      (*) https://docs.oracle.com/en/java/javase/15/docs/api/jdk.jshell/jdk/jshell/package-summary.html

            Assignee:
            Jan Lahoda
            Reporter:
            David Delabassee
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: