Skip to content

Commit

Permalink
8259863: doc: JShell snippet doesn't compile
Browse files Browse the repository at this point in the history
Reviewed-by: sundar
  • Loading branch information
lahodaj committed Mar 17, 2021
1 parent f9f2eef commit 41276eb
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/jdk.jshell/share/classes/jdk/jshell/package-info.java
Expand Up @@ -68,7 +68,7 @@
* fixed strings, but would come from the user. Below is a very simplified
* example of how the API might be used to implement a REPL.
* <pre>
* {@code
* {@code
* import java.io.ByteArrayInputStream;
* import java.io.Console;
* import java.util.List;
Expand All @@ -88,9 +88,9 @@
* List<SnippetEvent> events = js.eval(input);
* for (SnippetEvent e : events) {
* StringBuilder sb = new StringBuilder();
* if (e.causeSnippet == null) {
* if (e.causeSnippet() == null) {
* // We have a snippet creation event
* switch (e.status) {
* switch (e.status()) {
* case VALID:
* sb.append("Successful ");
* break;
Expand All @@ -104,16 +104,16 @@
* sb.append("Failed ");
* break;
* }
* if (e.previousStatus == Status.NONEXISTENT) {
* if (e.previousStatus() == Status.NONEXISTENT) {
* sb.append("addition");
* } else {
* sb.append("modification");
* }
* sb.append(" of ");
* sb.append(e.snippet.source());
* sb.append(e.snippet().source());
* System.out.println(sb);
* if (e.value != null) {
* System.out.printf("Value is: %s\n", e.value);
* if (e.value() != null) {
* System.out.printf("Value is: %s\n", e.value());
* }
* System.out.flush();
* }
Expand Down

1 comment on commit 41276eb

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.