Module jdk.jshell
Package jdk.jshell

Class Snippet

java.lang.Object
jdk.jshell.Snippet
Direct Known Subclasses:
ErroneousSnippet, ExpressionSnippet, PersistentSnippet, StatementSnippet

public abstract class Snippet extends Object
A Snippet represents a snippet of Java source code as passed to JShell.eval(java.lang.String). It is associated only with the JShell instance that created it. An instance of Snippet (including its subclasses) is immutable: an access to any of its methods will always return the same result. For information about the current state of the snippet within the JShell state engine, query JShell passing the Snippet.

Because it is immutable, Snippet (and subclasses) is thread-safe.

Since:
9
See Also: