RFR: 8264162: PickResult.toString() is missing the closing square bracket

Nir Lisker nlisker at openjdk.java.net
Thu Mar 25 13:35:30 UTC 2021


On Thu, 25 Mar 2021 12:29:38 GMT, Kevin Rushforth <kcr at openjdk.org> wrote:

> Simple fix to add a missing closing bracket to `PickResult::toString`. This includes a unit test that fails without the fix and passes with the fix.

modules/javafx.graphics/src/main/java/javafx/scene/input/PickResult.java line 204:

> 202:         }
> 203:         if (getIntersectedTexCoord() != null) {
> 204:                 sb.append(", texCoord = ").append(getIntersectedTexCoord());

Can you fix the double indentation in the `if` bodies?

modules/javafx.graphics/src/test/java/test/javafx/scene/input/MouseEventTest.java line 139:

> 137:                 case ']':
> 138:                     --bracketCount;
> 139:                     assertTrue("Too many closing brackets: " + str, bracketCount >= 0);

This test can fail due to a malformed `toString` result in the node (`getIntersectedNode()`), which I would think is outside the scope of this test. In practice, this test's result is dependent on what node I choose to test.

Shouldn't we be testing the structure of the string and not its contents?

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

PR: https://git.openjdk.java.net/jfx/pull/443


More information about the openjfx-dev mailing list