Misleading documentation for class java.nio.charset.spi.CharsetProvider

Christian Schulte cs at schulte.it
Thu Dec 6 17:26:10 UTC 2012


I am not sure if this is the correct mailing list to send this mail to.
Please apologize any inconvenience caused.

The JDK 7 documentation of class java.nio.charset.spi.CharsetProvider
states the following:

Charset providers are looked up via the current thread's context class

Looking at method 'private static Iterator providers()' of class
'java.nio.charset.Charset', the above documentation seems incorrect
since that method uses the system class loader.

ClassLoader cl = ClassLoader.getSystemClassLoader();
ServiceLoader<CharsetProvider> sl =
ServiceLoader.load(CharsetProvider.class, cl);

Is this intended ?


Christian Schulte

More information about the core-libs-dev mailing list