Skip to content
This repository has been archived by the owner on Nov 16, 2021. It is now read-only.

R7 Core draft 2017-3, 10.8.4.3 (Capability and Requirement version params) #36

Open
bjhargrave opened this issue Apr 21, 2017 · 2 comments
Labels
publiccomment Public comment

Comments

@bjhargrave
Copy link
Member

Original bug ID: BZ#214
From: Simon Spero <sesuncedu@gmail.com>
Reported version: unspecified

@bjhargrave
Copy link
Member Author

Comment author: Simon Spero <sesuncedu@gmail.com>

The type of the generated attribute is constrained to be Version, but for some namespaces the type is unconstrained, or specified to be a different type.

For example, osgi.contract (pre-R7) seemed to restrict the value to List, and now allows any of "Version, List and Version[]".

I'm just using contract as an example, since that is not the canonical use case (and is hard to process since the uses are pointed the wrong way.

Also, the Requirement version argument seems overly restrictive (if a single string format is used, the same code for parsing import versions could be used to generate the filter.


For both these cases, the version arg could be widened to Object, with capability taking String, Version, Version[], and List, and Requirement taking String, Version, and VersionRange.

The resulting attribute type of the attribute value for Capability can be restricted to Version or List (with services that permit arbitrary strings made to do things the hard way as punishment).

In the alternative, the existing behavior could be documented, with an explicit warning, or a multi-valued "versions" parameter could be added to @ Capability.

@bjhargrave
Copy link
Member Author

Comment author: @bjhargrave

Capability is an annotation. As such the version element cannot have a value of Object since that is not supported by annotations in Java.

If you use the version element of the Capability annotation, then generated capability will have a type of Version.

If you needed to define a contract capability with the Capability annotation and need to specify more than a single version, you can use the attribute element:

attribute({"version:List="1.0,1.1,2.0""})

The version element is to cover the majority of use cases but you can always us the attribute element for other use cases. Almost all capabilities should have exactly one version. The contract capability is rather unique.

Similarly for Requirement, if the version annotation does not cover your use case, you can specify it via the filter element.

So it seems that you can express the corner cases with the annotations, just not with the version element itself. Since this is possible, I don't see that the spec should change to alter the definition of the version elements of the Capability and Requirement annotations.

@bjhargrave bjhargrave added the publiccomment Public comment label May 1, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
publiccomment Public comment
Projects
None yet
Development

No branches or pull requests

1 participant