RFR: 8366733: Re-examine older java.text NF, DF, and DFS serialization tests
Naoto Sato
naoto at openjdk.org
Fri Sep 5 16:16:12 UTC 2025
On Thu, 4 Sep 2025 22:03:51 GMT, Justin Lu <jlu at openjdk.org> wrote:
> This PR cleans up the existing DecimalFormatSymbols, DecimalFormat, and NumberFormat serialization tests.
>
> As mentioned in https://github.com/openjdk/jdk/pull/27008 these tests can be re-visited.
>
> These older tests are either not run (since they rely on being run by older JDK versions), rely on hex dump files, or are simply outdated. These are now removed or updated and moved under **DecimalFormat/SerializationTest.java** and **DFSSerializationTest.java**. Additionally, tests to check the stream version invariants are added for DecimalFormat.
>
> Below are the existing tests that are removed or modified. (Their associated hex dump files are removed as well).
>
> **DFSDeserialization142.java & DFSSerialization142.java** (D)
>
> - They do not have Jtreg headers and are not run. The comments indicate they require a specific JDK version of 1.4.2. Instead, a currency symbol test is added in place.
>
> **NumberFormat/DFSSerialization.java** (D)
>
> - Test 1 checks if a DFS written from a 1.4.2 JDK with stream version of 2 when read has the correct String exponent and currency symbol. -> There is an existing test which checks the exponent. A New test is added in place of currency symbol test.
> - Test 2 checks that a DFS maintains the exponent separator and currency symbol when read. -> Tests are added in place of them of them.
> - Test 3 is unrelated to de serialization, and checks that the exponent separator symbol setter throws NPE. -> Test 3 is already covered by **SettersShouldThrowNPETest.java**.
>
> **SerializationLoad.java & SerializationSave.java** (D)
>
> - The save test depends on JDK 1.1.4, and is the code to write a DFS and DF. (It has no header and is not run.) The load test uses the saved 1.1.4 hex dump file to ensure the DFS and DF can be read, it did not check any specific invariants.
>
> **NumberRegression.java** (M)
>
> - Test4185761 and Test4069754 check NF/DF invariants and are ported to the dedicated serialization test file.
Although the existing tests are old and not run, I think the existing data can be reused. You can create overload for `deSer()` for these and test them. I believe they are the real serialized objects from the older releases, so I believe testing them still have value.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/27108#issuecomment-3258921072
More information about the core-libs-dev
mailing list