RFR: JDK-8261095: Add test for clhsdb "symbol" command [v3]

Vipin Sharma vsharma at openjdk.java.net
Wed Mar 10 04:57:31 UTC 2021


On Wed, 10 Mar 2021 04:49:27 GMT, Vipin Sharma <vsharma at openjdk.org> wrote:

>> test/hotspot/jtreg/serviceability/sa/ClhsdbSymbol.java line 68:
>> 
>>> 66:                                                       .map(addresses -> addresses[1])
>>> 67:                                                       .orElseThrow(() -> new RuntimeException("Cannot find address of " +
>>> 68:                                                               "the InstanceKlass for java.lang.Thread in output"));
>> 
>> These lines really don't format well, a reason why the previous `orElse()` version is probably better. Maybe you can make this work by moving the `.filter()` call to a new line that is indented 8 more than the previous line
>
> After moving the filter to the next line also can not fit this in one line.
> In addition to the filter, moving all characters starting from "new RuntimeException(...." also goes till 126 char.
> Following is one suggestion, does it look good?
> 
> String threadAddress = classOutput.lines()
>         .filter(part -> part.startsWith("java/lang/Thread"))
>         .map(part -> part.split(" @"))
>         .findFirst()
>         .map(addresses -> addresses[1])
>         .orElseThrow(() -> new RuntimeException(
>                 "Cannot find address of the InstanceKlass for java.lang.Thread in output"));

Formatting in my comment is not clear, so I have added one new commit for this.

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

PR: https://git.openjdk.java.net/jdk/pull/2863


More information about the serviceability-dev mailing list