RFR [9] 8055955: (ch) Remove unnecessary initialization of InetAddress from FileChannel

Chris Hegarty chris.hegarty at oracle.com
Mon Aug 25 20:36:35 UTC 2014


During some recent refactoring, JDK-8025306, an unnecessary initialization of the InetAddress classes was added to the NIO implementation. InetAddress classes only need initialization for network channel types. This change does just that.

http://cr.openjdk.java.net/~chegar/8055955/webrev.00/webrev/

Example of the problem:

$ cat Test.java 
public class Test { 
    public static void main(String[] args) throws Exception { 
        java.io.File file = new java.io.File("."); 
        java.nio.channels.FileChannel fc = java.nio.channels.FileChannel.open(file.toPath()); 
    } 
} 
$ javac Test.java 
$ jdk9/build/linux-x86_64-normal-server-release/jdk/bin/java -verbose:class Test | grep InetAddress 
[Loaded java.net.InetAddress from jdk9/build/linux-x86_64-normal-server-release/jdk/modules/java.base] [Loaded java.net.InetAddress$1 from jdk9/build/linux-x86_64-normal-server-release/jdk/modules/java.base] [Loaded java.net.InetAddress$InetAddressHolder from jdk9/build/linux-x86_64-normal-server-release/jdk/modules/java.base] 
[Loaded java.net.InetAddress$Cache from jdk9/build/linux-x86_64-normal-server-release/jdk/modules/java.base] 
[Loaded java.net.InetAddress$Cache$Type from jdk9/build/linux-x86_64-normal-server-release/jdk/modules/java.base] 
[Loaded java.net.InetAddressImplFactory from jdk9/build/linux-x86_64-normal-server-release/jdk/modules/java.base] 
[Loaded java.net.InetAddressImpl from jdk9/build/linux-x86_64-normal-server-release/jdk/modules/java.base] 
[Loaded java.net.InetAddress$2 from jdk9/build/linux-x86_64-normal-server-release/jdk/modules/java.base]

-Chris.


More information about the nio-dev mailing list