[PATCH] Enhance ServiceLoader to understand factory methods
jaroslav.tulach at sun.com
Sat Oct 4 17:28:25 UTC 2008
Proposal: Enhance ServiceLoader to understand factory methods
Justification: A lot of our services in NetBeans are final classes. Still,
would like to use the META-INF/services registration to register their
providers. Currently this does not work, we either need to unfinalize the
classes (which restricts future evolution options) or use different ways of
registering the providers. We propose simple and backward compatible
extension to current ServiceLoader registration scheme. If accepted,
NetBeans'll eliminate our non-standard registration methods, while keeping
benefits of final classes. Moreover the same techniques will be available to
any JavaSE project.
Risks: API change includes simple, compatible extension. New code is able to
accept old registrations. Old code (JDK6) will generate
ServiceConfigurationError in case of seeing new registration, however.
Test: I have found tests in test/java/util/ServiceLoader/ directory and I've
modified them to verify also our new usecase. All of them are passing, if I
run them by running ./basic.sh script - I am not sure if that is the right
way of running your tests.
I am attaching my current patch. Let me know what shall I change to allow
to be integrated to OpenJDK7. Thanks a lot.
NetBeans Platform Architect
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 4591 bytes
Desc: not available
More information about the core-libs-dev