RFR: JDK-8261095: Add test for clhsdb "symbol" command [v3]
Vipin Sharma
vsharma at openjdk.java.net
Wed Mar 10 04:52:08 UTC 2021
On Wed, 10 Mar 2021 04:30:57 GMT, Chris Plummer <cjplummer at openjdk.org> wrote:
>> Vipin Sharma has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Started using orElseThrow and removed null check following this
>
> 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"));
-------------
PR: https://git.openjdk.java.net/jdk/pull/2863
More information about the serviceability-dev
mailing list