Service Providers and versioning
Sean Mullan
sean.mullan at oracle.com
Wed Apr 18 11:58:59 PDT 2012
On 04/18/2012 12:29 PM, Jesse Glick wrote:
> On 04/18/2012 11:50 AM, Sean Mullan wrote:
>> the app module would be requesting a PKIX CertPathValidator service
>
> OSGi supports service properties and capability attributes, which could
> handle such situations, but the specification is rather more complex
> than Jigsaw's current proposal. Ditto the NetBeans module system's
> @NamedServiceDefinition/Lookups.forPath and provide/require tokens.
>
>> that has been updated to support API changes to that SPI in JDK 8.
>
> It does not seem that the signature of CertPathValidatorSpi changed in
> JDK 8. I guess what you are getting at is that an object can
> successfully implement this interface at the Java language level yet not
> actually behave correctly (throw InvalidAlgorithmParameterException),
> which suggests a minor design flaw - lack of strong typing, perhaps
> predating generics.
I'm not only talking about the SPI, but the input and output classes,
for example in the case of CertPathValidatorSpi, there are the
CertPathParameters, CertPath, CertPathValidatorResult and their
subclasses. If new methods are added to those subclasses, I'd love to be
able to request a service that I know has been updated to support them.
Currently, we generally avoid adding any new methods to those
subclasses, because we don't know if the SPI implementations have been
updated to support them.
> Anyway if a service written for an earlier version of Java has not been
> updated for incompatible SPI changes in JDK 8, then its containing
> module should not be resolvable against JDK 8 to begin with - it should
> declare a conservative version range in its dependencies - and so there
> is no need for the app module to exclude it.
Yes, but it would only be a recommendation, and the service could simply
choose not to declare a conservative version range, and assume their
code should be compatible with new JDK versions. Anyway, though good
point - perhaps if we encourage service provider developers to do that
this is less of an issue.
--Sean
More information about the jigsaw-dev
mailing list