RFR: javax.xml.stream: Using ServiceLoader to load JAXP stream factories (7169894: JAXP Plugability Layer: using service loader)
Daniel Fuchs
daniel.fuchs at oracle.com
Wed Dec 19 09:45:36 UTC 2012
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
More information about the core-libs-dev
mailing list