Interface SnippetOutcome

All Known Subinterfaces:
SnippetOutcome.CompilerErrors, SnippetOutcome.CompilerSemanticErrors, SnippetOutcome.CompilerSyntaxErrors, SnippetOutcome.ControlViolation, SnippetOutcome.ExceptionThrown, SnippetOutcome.Interrupted, SnippetOutcome.Overwritten, SnippetOutcome.Successful, SnippetOutcome.SuccessfulNoValue, SnippetOutcome.SuccessfulWithValue, SnippetOutcome.Suspended, SnippetOutcome.UnresolvedReferences

Captures the outcome from one of the Snippets that constitute a JavaBox script.

A snippet can fail by failing to compile, compiling into bytecode that violates a Control, throwing an exception during execution, etc.

For some outcomes that implement SnippetOutcome.HasSnippet, additional information is available via the associated JShell snippet.

  • Method Details

    • box

      JavaBox box()
      Get the associated JavaBox.
      Returns:
      associated container
    • source

      String source()
      Get the source code of the snippet whose outcome is represented by this instance.

      This will equal the substring of the original script source starting at offset().

      Returns:
      snippet source
      See Also:
    • offset

      LineAndColumn offset()
      Get the position within the original script source of the source() associated with this instance.
      Returns:
      snippet source offset in original script
      See Also: