7197637: (ch) sun.nio.ch.Default* cause providers for other platforms to be included in rt.jar
Alan Bateman
Alan.Bateman at oracle.com
Tue Sep 11 07:40:10 PDT 2012
sun.nio.ch.DefaultSelectorProvider and
DefaultAsycnhronousChannelProvider select the appropriate provider based
on the OS. As there are static references to each of the provider
classes it means the classes for other platforms get compiled implicitly
and so there are additional classes in rt.jar that are never used. The
real issue here is that we don't separate Solaris and Linux specific
code and this is something that I think that we will need to addressed
some day. In the mean-time I've changed the create methods to use
reflection, in the same way that we already have in
sun.nio.fs.DefaultFileSystemProvider.
Mandy - while I was there I also changed the class loader specified to
Class.forName to be the defining loader of the Default* class, this
change has no effect for now but may avoid us needing to change this
again when we eventually move to modules.
The webrev with the proposed changes is here:
http://cr.openjdk.java.net/~alanb/7197637/webrev/
-Alan.
More information about the nio-dev
mailing list