RFR: 8355443: [java.io] Use @requires tag instead of exiting based on File.separatorChar value

Naoto Sato naoto at openjdk.org
Thu Apr 24 16:44:45 UTC 2025


On Thu, 24 Apr 2025 00:33:20 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:

> For tests of the `java.io` package, instead of doing this
> 
>     public static void main(String[] args) throws Exception {
>         if (File.separatorChar != '\') {
>             /* This test is only valid on win32 systems */
>             return;
>         }
> 
> do this
> 
>    @requires (os.family == "windows")

Nice cleanup.

test/jdk/java/io/pathNames/win32/SJIS.java line 51:

> 49:            that use the SJIS encoding */
> 50:         String enc = System.getProperty("file.encoding");
> 51:         if ((enc == null) || !enc.equals("SJIS")) return;

I just wonder this test has ever run since JDK18, as file.encoding is always UTF-8 unless COMPAT is specified (and this test case does not specify it)

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

PR Review: https://git.openjdk.org/jdk/pull/24838#pullrequestreview-2791863041
PR Review Comment: https://git.openjdk.org/jdk/pull/24838#discussion_r2058850665


More information about the core-libs-dev mailing list