ClassLoader::getPlatformResource*() methods

Richard Opalka ropalka at redhat.com
Wed Aug 31 11:49:43 UTC 2016


Hi Alan,


On 08/31/2016 01:12 PM, Alan Bateman wrote:
> On 31/08/2016 11:33, Richard Opalka wrote:
>
>> Hi Jigsaw Team,
>>
>>
>> There's new ClassLoader::getPlatformClassLoader() method introduced 
>> with project Jigsaw.
>>
>> There are three ClassLoader::getSystemResource*() methods available
>>
>> that fallback to BootLoader if SystemClassLoader is not available.
>>
>> Shouldn't ClassLoader::getPlatformResource*() methods be defined as well
>>
>> providing similar fallback mechanism?
> ClassLoader.getSystemClassLoader() should never return null. I see we 
> have a few residual places that still check for null so some clean-up 
> needed. The @return description also needs clean-up.
Good to know.
>
> So I'm curious if you have a scenario where there is no system class 
> loader. Is this instrumentation early in the startup or something 
> reading a private field, again during early startup, rather than 
> calling the getSystemClassLoader method?
I don't have such scenario. I asked because I was just curious (it took 
my attention). The explanation ClassLoader.getSystemClassLoader() can 
not return null is satisfactory.
>
> As regards the platform class loader then 
> ClassLoader.getPlatformClassLoader().getResourceXXX should be the 
> equivalent of introducing new methods so it hardly seems worth it.
I see. If it's not worth it maybe deprecating 
ClassLoader::getSystemResource*() methods would make sense? (Just my 
0.02 $)
>
> -Alan
Richard


More information about the jigsaw-dev mailing list