<i18n dev> RFR: 8295670: Remove duplication in java/util/Formatter/Basic*.java

Naoto Sato naoto at openjdk.org
Fri Oct 28 22:46:49 UTC 2022


On Fri, 28 Oct 2022 21:51:03 GMT, Justin Lu <duke at openjdk.org> wrote:

> Issue: Duplication of methods between Basic*.java test classes, due to auto generation by genBasic.sh
> 
> Fix: Reorganize parts of Basic-X.java.template into base class in Basic.java. Toggled -nel flag for generation script (genBasic.sh) to remove excessive white space. Moved a previous direct change to BasicDateTime.java into the template.
> 
> Note: Main files to look at are Basic.java and Basic-X.java.template, as the rest are a reflection of the auto generation

test/jdk/java/util/Formatter/Basic-X.java.template line 1612:

> 1610:         list.remove("America/WhiteHorse");
> 1611:         list.remove("Canada/Yukon");
> 1612:         ids = list.toArray(new String[list.size()]);

It's not your change but I just noticed this. Since we specifically test only for `CLDR` provider (as in `BasicTestLauncher`), I wonder we could remove this portion. Even if we do need this piece, it could be simplified as:

ids = Arrays.stream(ids).filter(tz -> !tz.equals(...)).toArray(String[]::new)

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

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


More information about the i18n-dev mailing list