RFR: 8301065: Handle control characters in java_lang_String::print [v2]

Ioi Lam iklam at openjdk.org
Mon Apr 17 16:56:35 UTC 2023


On Mon, 17 Apr 2023 05:13:23 GMT, David Holmes <dholmes at openjdk.org> wrote:

> Escaping the control characters this way seems quite reasonable to me. I assume we never intentionally include them, but if tracking down a bug we might be printing a corrupt string and so this aids in showing the actual character content. 

We actually have some intentional use of non printable characters. For example, for string concatenation like this:


String x = ....;
String s = "abc" + x + "xyz";


We'll pass a parameter to the  `StringConcatFactory.makeConcatWithConstants()` bootstrap method that looks like this:


"abc\u0001xyz"

-------------

PR Comment: https://git.openjdk.org/jdk/pull/12190#issuecomment-1511739022


More information about the hotspot-runtime-dev mailing list