Skip to content

Commit 79d447e

Browse files
Hari Prasad KummariPaul Hohensee
authored andcommitted
8359127: Amend java/nio/channels/DatagramChannel/PromiscuousIPv6.java to use @requires for OS platform selection
Backport-of: 78b1360e7de84585d6e387ac6e0789a4d02187d5
1 parent 7145ba1 commit 79d447e

File tree

1 file changed

+7
-17
lines changed

1 file changed

+7
-17
lines changed

test/jdk/java/nio/channels/DatagramChannel/PromiscuousIPv6.java

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -30,6 +30,7 @@
3030
* PromiscuousIPv6
3131
* @run main PromiscuousIPv6
3232
* @key randomness
33+
* @requires (os.family == "linux") | (os.family == "mac")
3334
*/
3435

3536
import java.nio.ByteBuffer;
@@ -201,26 +202,15 @@ static void test(ProtocolFamily family,
201202
}
202203
}
203204

204-
/*
205-
* returns true if platform allows an IPv6 socket join an IPv4 multicast group
206-
*/
207-
private static boolean supportedByPlatform() {
208-
return Platform.isOSX() || Platform.isLinux();
209-
}
210-
211205
public static void main(String[] args) throws IOException {
212206

213207
boolean hasIPV6MulticastAll;
214208

215-
if (!supportedByPlatform()) {
216-
throw new SkippedException("This test should not be run on this platform");
217-
} else {
218-
int major = Platform.getOsVersionMajor();
219-
int minor = Platform.getOsVersionMinor();
220-
hasIPV6MulticastAll =
221-
Platform.isOSX() ||
222-
(Platform.isLinux() && ((major > 4) || ((major == 4 && minor >= 20))));
223-
}
209+
int major = Platform.getOsVersionMajor();
210+
int minor = Platform.getOsVersionMinor();
211+
hasIPV6MulticastAll =
212+
Platform.isOSX() ||
213+
(Platform.isLinux() && ((major > 4) || ((major == 4 && minor >= 20))));
224214

225215
NetworkConfiguration.printSystemConfiguration(System.out);
226216
List<NetworkInterface> nifs = NetworkConfiguration.probe()

0 commit comments

Comments
 (0)