It's a preview feature in jdk13 but seems mainstream from jdk14.
Suggest we add a Boolean variant like we did for
This doesn't avoid the problem but provides an easy workaround.
The Java behavior is the same as the Groovy one for many cases but is different in how in treats the last line.
For Java, the behavior is "The leading white space characters on the last line are also counted even if blank.".
Here Groovy ignores the last line in calculating the length of incidental whitespace but Java does not.
Note: dots are used to indicate incidental whitespace in this example.
Here Groovy and Java will get the same calculation and yield the same result.