[PATCH] Enhance ServiceLoader to understand factory methods

Jaroslav Tulach jtulach at netbeans.org
Thu Oct 16 17:38:23 UTC 2008

I can imagine, dear core-libs members, that you are all busy with your jobs,
however at least give me hope: Can I get my patch into the OpenJDK in
reasonable timeframe or not?

Thanks in advance for your reply.

Jaroslav Tulach wrote:
> Proposal: Enhance ServiceLoader to understand factory methods
> Justification: A lot of our services in NetBeans are final classes. Still,
> we
> 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
> this
> to be integrated to OpenJDK7. Thanks a lot.
> Jaroslav Tulach
> NetBeans Platform Architect

More information about the core-libs-dev mailing list