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

doc: JShell snippet doesn't compile

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P4
    • 17
    • 15
    • tools
    • None
    • b14

    Description

      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

      Attachments

        Issue Links

          Activity

            People

              jlahoda Jan Lahoda
              ddelabassee David Delabassee
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: