Community
Participate
Working Groups
At the moment, the only way to ensure a version string conforms to the version requirements it to create a PluginVersionIdentifier and catch a runtime exception. This is specifically discouraged by the spec and the exception itself (AssertationFailedException) is not API. We need a public static method on PluginVersionIdentifier that informs about problems without throwing an exception. For example: public static IStatus verifyVersion(String version); If version conforms, it returns null. Otherwise, a status object is created and returned with an exact reason why the string does not conform. Users can use this status object to throw their own exceptions or show error dialogs.
Recommend the following to remain consistent with rest of Core validation API. Perhaps to reside on org.eclipse.core.runime.Plugin or PluginVersionIdentifier. IStatus validateVersionIdentifier(String identifier) Returns an OK status if all is well. Otherwise the returning status object will contain the reason(s) why the version identifier is not valid.
Looks good to me.
The method will be on: org.eclipse.core.runtime.PluginVersionIdentifier /** * Validates the given string as a plug-in version identifier. * * @param version the string to validate * @return a status object with code <code>IStatus.OK</code> if * the given string is valid as a plug-in version identifier, * otherwise a status object indicating what is wrong with * the string * @since 2.0 */ public static IStatus validateVersion(String version); Ready to be reviewed and released.
Released as spec'd above.