Giter Club home page Giter Club logo

Comments (2)

bjhargrave avatar bjhargrave commented on July 18, 2024

Comment author: Simon Spero <[email protected]>

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.

from design.

bjhargrave avatar bjhargrave commented on July 18, 2024

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.

from design.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.