Class SnippetEvent
java.lang.Object
jdk.jshell.SnippetEvent
A description of a change to a Snippet. These are generated by direct changes
to state with
JShell.eval(String) or
JShell.drop(Snippet),
or indirectly by these same methods as
dependencies change or Snippets are overwritten. For direct changes, the
causeSnippet() is null.
SnippetEvent is immutable: an access to
any of its methods will always return the same result.
and thus is thread-safe.
- Since:
- 9
-
Method Summary
Modifier and TypeMethodDescriptionEither the snippet whose change caused this update ornull.An instance ofUnresolvedReferenceException, if an unresolved reference was encountered, or an instance ofEvalExceptionif an exception was thrown during execution, otherwisenull.booleanIndicates whether the signature has changed.The status before the transition.snippet()The Snippet which has changedstatus()The after status.toString()Return a string representation of the eventvalue()The result value of successful run.Methods declared in class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitModifier and TypeMethodDescriptionprotected Objectclone()Answers a new instance of the same class as the receiver, whose slots have been filled in with the values in the slots of the receiver.booleanCompares the argument to the receiver, and answers true if they represent the same object using a class specific comparison.protected voidfinalize()Deprecated, for removal: This API element is subject to removal in a future version.May cause performance issues, deadlocks and hangs.getClass()Answers the unique instance of java.lang.Class which represents the class of the receiver.inthashCode()Answers an integer hash code for the receiver.final voidnotify()Causes one thread which iswaiting on the receiver to be made ready to run.final voidCauses all threads which arewaiting on the receiver to be made ready to run.final voidwait()Causes the thread which sent this message to be made not ready to run pending some change in the receiver (as indicated bynotifyornotifyAll).final voidwait(long time) Causes the thread which sent this message to be made not ready to run either pending some change in the receiver (as indicated bynotifyornotifyAll) or the expiration of the timeout.final voidwait(long time, int frac) Causes the thread which sent this message to be made not ready to run either pending some change in the receiver (as indicated bynotifyornotifyAll) or the expiration of the timeout.
-
Method Details
-
snippet
The Snippet which has changed- Returns:
- the return the Snippet whose
Statushas changed.
-
previousStatus
The status before the transition. If this event describes a Snippet creation returnNONEXISTENT.- Returns:
- the previousStatus
-
status
The after status. Note: this may be the same as the previous status (not all changes cause aStatuschange.- Returns:
- the status
-
isSignatureChange
public boolean isSignatureChange()Indicates whether the signature has changed. Coming in or out of definition is always a signature change. An overwritten Snippet(status == OVERWRITTEN)is alwaysfalseas responsibility for the definition has passed to the overwriting definition.- Returns:
trueif the signature changed; otherwisefalse
-
causeSnippet
-
exception
An instance ofUnresolvedReferenceException, if an unresolved reference was encountered, or an instance ofEvalExceptionif an exception was thrown during execution, otherwisenull.- Returns:
- the exception or
null.
-
value
The result value of successful run. The value is null if not executed or an exception was thrown.- Returns:
- the value or
null.
-
toString
-