Skip to content

Commit b030c7d

Browse files
viktorklang-orajaikiran
authored andcommitted
8225235: Unused field defaultIndex in NetworkInterface
Reviewed-by: chegar, vtewari, dfuchs, jpai
1 parent a07975b commit b030c7d

File tree

2 files changed

+2
-11
lines changed

2 files changed

+2
-11
lines changed

Diff for: src/java.base/share/classes/java/net/NetworkInterface.java

+1-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2000, 2021, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2000, 2022, 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
@@ -53,18 +53,12 @@ public final class NetworkInterface {
5353
private NetworkInterface parent = null;
5454
private boolean virtual = false;
5555
private static final NetworkInterface defaultInterface;
56-
private static final int defaultIndex; /* index of defaultInterface */
5756

5857
static {
5958
jdk.internal.loader.BootLoader.loadLibrary("net");
6059

6160
init();
6261
defaultInterface = DefaultInterface.getDefault();
63-
if (defaultInterface != null) {
64-
defaultIndex = defaultInterface.getIndex();
65-
} else {
66-
defaultIndex = 0;
67-
}
6862
}
6963

7064
/**

Diff for: src/java.base/unix/native/libnet/NetworkInterface.c

+1-4
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,6 @@ jfieldID ni_bindsID;
101101
jfieldID ni_virutalID;
102102
jfieldID ni_childsID;
103103
jfieldID ni_parentID;
104-
jfieldID ni_defaultIndexID;
105104
jmethodID ni_ctrID;
106105

107106
static jclass ni_ibcls;
@@ -187,9 +186,7 @@ JNIEXPORT void JNICALL Java_java_net_NetworkInterface_init
187186
CHECK_NULL(ni_ib4broadcastID);
188187
ni_ib4maskID = (*env)->GetFieldID(env, ni_ibcls, "maskLength", "S");
189188
CHECK_NULL(ni_ib4maskID);
190-
ni_defaultIndexID = (*env)->GetStaticFieldID(env, ni_class, "defaultIndex",
191-
"I");
192-
CHECK_NULL(ni_defaultIndexID);
189+
193190
initInetAddressIDs(env);
194191
}
195192

0 commit comments

Comments
 (0)