RFR: 8367772: Refactor createUI in PassFailJFrame

Alexey Ivanov aivanov at openjdk.org
Tue Sep 16 19:31:35 UTC 2025


Code review https://git.openjdk.org/jdk/pull/27197 for [JDK-8367348](https://bugs.openjdk.org/browse/JDK-8367348) made me think how to avoid adding more parameters to methods, in particular `createInstructionUIPanel`. The `Builder` object captures all the required configuration data, it is the `Builder` object that should be used to pass the configuration.

This changeset refactors UI creation in `PassFailJFrame`.

* The remaining constructor that accepts positional parameters now creates a builder to pass the configuration data.
* The `createInstructionUIPanel` method now accepts `Builder` instead of a set of parameters from it.
* The `createUI` method with positional parameters has become redundant and is removed. Code duplication between two versions of `createUI` is now eliminated.

There are no functional differences. I verified it by launching a few tests which use `PassFailJFrame` constructors and builder.

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

Commit messages:
 - Reimplement the remaining PassFailJFrame constructor via builder
 - 8367772: Refactor createUI in PassFailJFrame

Changes: https://git.openjdk.org/jdk/pull/27321/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=27321&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8367772
  Stats: 55 lines in 1 file changed: 8 ins; 33 del; 14 mod
  Patch: https://git.openjdk.org/jdk/pull/27321.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/27321/head:pull/27321

PR: https://git.openjdk.org/jdk/pull/27321


More information about the client-libs-dev mailing list