RFR: 8299829: In jshell, the output of "0".repeat(49999)+"2" ends with a '0' [v2]
Adam Sotona
asotona at openjdk.org
Tue Jan 10 16:14:44 UTC 2023
> "0".repeat(49999)+"2" correctly evaluates to a string with a terminating '2'.
> However, jshell outputs it with a terminating '0'.
>
> Jshell provides double truncation of long Strings.
> One is performed in jdk.jshell.execution.ExecutionControlForwarder to fit into MAX_UTF_CHARS = 21844 (which is exactly the point where "2" disappears).
> Second truncation is performed in jdk.internal.jshell.tool.Feedback to fit presentation requirements.
> While ExecutionControlForwarder truncates right part of the String, Feedback truncated inner part in 2/3 and joins the parts with " ... ".
>
> Proposed patch fixes ExecutionControlForwarder to truncate long Strings the same way as Feedback, so the right part of any long String won't disappear and double or repeated truncation provides consistent results.
>
> Please review :)
>
> Thanks,
> Adam
Adam Sotona has updated the pull request incrementally with one additional commit since the last revision:
added test
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/11927/files
- new: https://git.openjdk.org/jdk/pull/11927/files/d6ff2bf2..6f014b6c
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=11927&range=01
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=11927&range=00-01
Stats: 3 lines in 1 file changed: 1 ins; 0 del; 2 mod
Patch: https://git.openjdk.org/jdk/pull/11927.diff
Fetch: git fetch https://git.openjdk.org/jdk pull/11927/head:pull/11927
PR: https://git.openjdk.org/jdk/pull/11927
More information about the kulla-dev
mailing list