On 12/19/12 12:10 AM, Joe Wang wrote:
It's different. If 'foo.bar' is specified but not found, it indicates a configuration error. If the factory falls back to an impl by the default factory id, it would serve to hide the error.
Yes - I fully agree with that.
Note that newInstance/newFactory with a factoryId parameter do not fall back to the default implementation.
Ahh! Yes I missed that. When called from newInstance with a factoryId parameter the fallbackClassname parameter
is null...

So should we still call ServiceLoader when fallbackClassname is null and factoryId is type.getName()? It would be more backward compatible - since previously it was looking in the jars and found (valid) providers registered with that name.

On the other hand we could alter the spec to say that if no property with the factoryId name is found - then no fallback loading is perform (either on ServiceLoader or system-default implementation) and an error is thrown.

-- daniel

Reply via email to