Bug 268412 - Support for items in /list
Support for items in /list
Status: RESOLVED FIXED
Product: java
Classification: Unclassified
Component: JShell
Dev
PC Windows 7
: P2 (vote)
: Dev
Assigned To: Svata Dedic
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2016-10-07 21:25 UTC by Geertjan Wielenga
Modified: 2016-12-01 15:42 UTC (History)
0 users

See Also:
Issue Type: DEFECT
:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Geertjan Wielenga 2016-10-07 21:25:49 UTC
When you use /list, you properly see the valid snippets you’ve entered so far. But when you then use

/1
/2

etc. to execute the snippets you’ve typed so far, it instead executes the default imports that are loaded when the session starts.
Comment 1 Paul Deitel 2016-10-16 13:09:57 UTC
This is related to the bug that’s already filed about /# executing the wrong snippet.

I was looking at JShell in NetBeans again this morning and noticed your prompt is

	[#] ->

The first # displayed is 9, which I assume is because it’s treating JShell’s default imports and printf definition as 1-8. That is different from how JShell does it, where the first snippet you enter is #1. 

Another difference I noticed is that command-line JShell numbers only VALID snippets sequentially. So, for example, if you enter a valid snippet, followed by a snippet with an error, followed by another valid snippet, the two valid snippets are numbered 1 and 2 and the invalid one is e1. If you then execute /2, the second VALID snippet is recalled, not the one with the error that was typed second.

In NetBeans, /# always recalls the snippet based on the number in the [#] -> prompt.

I believe this work the same as in command-line JShell.
Comment 2 Svata Dedic 2016-12-01 15:42:28 UTC
/n history command should now reexecute snippet "n" (as seen in /list command). Prompt numbers correspond to snippet numbers.


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo