Output of expression values <was> Re: Printing of array-valued elements

Paul Sandoz paul.sandoz at oracle.com
Thu Aug 6 20:33:39 UTC 2015


On 5 Aug 2015, at 17:09, Robert Field <robert.field at oracle.com> wrote:

> All good suggestions, thanks, created:
> 
> 8133020 <https://bugs.openjdk.java.net/browse/JDK-8133020>
> JShell API: special printing for arrays
> 

Same applies to Collection as well (not sure we can always do the same for Iterable given it might be traversable once only in some rare cases).

I think there should also be truncation for toString beyond a certain length e.g.:  it could be something like (aligned to the columns for a certain number of rows):

-> Stream.generate(() -> "A").limit(10000).collect(Collectors.joining(""));
| String $1 = “AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA..."

IMO the current output is rather verbose:

-> new Object()
|  Expression value is: java.lang.Object at 2812cbfa
|    assigned to temporary variable $5 of type Object

It could be (for default verbosity settings):

-> new Object()
| Object $5 = java.lang.Object at 2812cbfa

?

Paul.


More information about the kulla-dev mailing list