Reviewer and committer request for 7198496

Paul Sandoz paul.sandoz at oracle.com
Thu Oct 4 09:19:35 UTC 2012


On Oct 4, 2012, at 10:44 AM, Chris Hegarty <chris.hegarty at oracle.com> wrote:
>> 
>> Sorry but that is just the dual incorrect statement of what is in
>> getContextClassLoader. It is not a meaningful description, in fact it is
>> incorrect because null only ever means the bootstrap loader, never the
>> system class loader - and the null can't mean two different things. And
>> what is "or failing that" supposed to mean?
>> 
>> These parts of the javadoc for get/setContextClassLoader are simply wrong.
> 
> They should be non-normative statements in the method description to give general guidance as to the interpretation of null.
> 

If i had 10 service providers, for service interface MyIterface, in jars added on my class path and i had application code that did the following:

  public static void main(String... args) throws Exception {
    Thread.currentThread().setContextClassLoader(null);
    int i = 0;
    for (MyIterface mi : ServiceLoader.load(MyIterface.class)) {
      i++;
    }
    System.out.println(i);
  }
  
What do you think should be the result of executing the above?

Paul.


More information about the core-libs-dev mailing list