Community
Participate
Working Groups
I'm using PDE to find a set of bundles I'm interested in, then using PDE's IPluginModelBase to get a BundleDescription. From the bundle description I'm looking at each bundle's ImportPackageSpecification and org.eclipse.osgi.service.resolver.VersionRange. From this level, there is no way to tell if the original bundle does not have a maximum version range on an import. Or conversely, if you want to tell if a bundle has no meaningful upper range, you have to create your own copy of versionMax to compare the maximum range to. It seems like there should be a VersionRange.isMaximumSet(), or more likely the versionMax field should just be exposed to save clients from creating their own.
Consider in 3.7. Too late for 3.6.
As a workaround, the way to tell would be something like this: Version testVersion = new Version(Integer.MAX_VALUE, Integer.MAX_VALUE, Integer.MAX_VALUE); range.isIncluded(testVersion); or some variation of looking at range.getMaximum() to see if it has Integer.MAX_VALUE
Yup, that's essentially what I'm doing - just thought it would be cleaner if there was something built in. Thanks for the quick response, 3.7 is fine.
Move all 3.8 bugs to Juno.
In OSGi R4.4 OSGi is going to provide a VersionRange class. This new class should provide us a way to do this.
In bug 366419 I released a fix to rebase the Equinox VersionRange class on top of the new OSGi VersionRange class. The method org.eclipse.osgi.service.resolver.VersionRange.getMaximum() has been deprecated. Use the method org.osgi.framework.VersionRange.getRight() instead. This method will return a null value when the right endpoint (maximum version) is infinity.