LibraryToggle FramesPrintFeedback

The basic principle of semantic versioning is that an increment to a major, minor, or micro part of a version signals a particular degree of compatibility or incompatibility with previous versions of a package. The Semantic Versioning technical white paper from the OSGi Alliance makes specific recommendations about how to interpret each of the major, minor, and micro parts of a version. Based on these definitions, the paper explains how to assign a version number to an exported package and how to assign a version range to an imported package.

This section summarizes the recommendations of the OSGi technical white paper.

To figure out how much version flexibility we can allow, we first need to consider the rules for backward compatibility in Java. Java is one of the few languages that explicitly considers issues of binary compatibility in its specification and the detailed rules can be found in the Binary Compatibility chapter of The Java Language Specification. The following is an incomplete list of changes that are binary compatibility with consumers of particular classes or interfaces:

  • Adding new fields, methods, or constructors to an existing class or interface.

  • Deleting private fields, methods, or constructors of a class.

  • Deleting package-only access fields, methods, or constructors of a class or interface.

  • Re-ordering the fields, methods, or constructors in an existing type declaration.

  • Moving a method upward in the class hierarchy.

  • Reordering the list of direct super-interfaces of a class or interface.

  • Inserting new class or interface types in the type hierarchy.

The fundamental idea of semantic versioning is that a bundle's version should indicate when the bundle breaks binary compatibility with its preceding version, bearing in mind that there are different kinds of binary compatibility: compatibility of consumers and compatibility of providers. The OSGi Semantic Versioning technical white paper proposes the following versioning conventions:

<major>

When a change breaks binary compabitility with both consumers and providers, increment the bundle's major version number. For example, a version change from 1.3 to 2.0 signals that the new bundle version is incompatible with older consumers and providers.

<minor>

When a change breaks binary compatibility with providers, but not consumers, increment the bundle's minor version number. For example, a version change from 1.3 to 1.4 signals that the new bundle version is incompatible with older providers, but compatible with older consumers.

<micro>

A change in micro version does not signal any backward compatibility issues. The micro version can be incremented for bug fixes that affect neither consumers nor providers of the API.

<qualifier>

The qualifier is typically used as a build identifier—for example, a time stamp.

Comments powered by Disqus