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

Alan Bateman Alan.Bateman at oracle.com
Thu Dec 6 17:50:27 UTC 2012


On 06/12/2012 17:26, Christian Schulte wrote:
> Hello,
>
> 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
> loader.
> [...]
>
> 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 ?
>
This is a long standing issue (going back to 1.4), we should remove this 
from the javadoc.

-Alan.




More information about the core-libs-dev mailing list