RFR: 8263659: Reflow GTestResultParser for better readability
Aleksey Shipilev
shade at openjdk.java.net
Wed Mar 17 12:11:00 UTC 2021
On Sat, 13 Mar 2021 22:13:39 GMT, Alex Blewitt <github.com+76791+alblue at openjdk.org> wrote:
> As noted by https://sonarcloud.io/code?id=shipilev_jdk&selected=shipilev_jdk%3Atest%2Fhotspot%2Fjtreg%2Fgtest%2FGTestResultParser.java there are a few fixes that can be applied for the GTestResultParser:
>
> * Avoiding nested 'try' statements
> * Avoiding nested 'switch' statements
> * Adding a break for each switch case to prevent accidental/unwanted fall-through
> * Disabling ability to load from remote files when parsing XML files
Please change this PR synopsis to "8263659: Reflow GTestResultParser for better readability" to get this hooked properly. Also, enable testing, see "Pre-submit test status" in "Checks".
test/hotspot/jtreg/gtest/GTestResultParser.java line 52:
> 50: if (XMLStreamConstants.START_ELEMENT == xmlReader.next()) {
> 51: switch (xmlReader.getLocalName()) {
> 52: case "testsuite":
Let's write this as:
while (xmlReader.hasNext()) {
int code = xmlReader.next();
if (code == XMLStreamConstants.START_ELEMENT) {
switch (xmlReader.getLocalName()) {
-------------
Changes requested by shade (Reviewer).
PR: https://git.openjdk.java.net/jdk/pull/2991
More information about the hotspot-dev
mailing list