Public APIs and version ranges

When making changes to a bundle, the appropriate segment of the version number should be incremented. If the API doesn't change, then clearly just the micro version should be updated. However, if there's new functionality, then the minor version should be updated, and the major version should be updated for backward incompatible changes.

But what is a backward incompatible change? It depends on what the change is. For example, a new method on an interface called by clients is a minor change since it's new functionality, the interface will be a subset of the previous version. However, if the client is expected to implement the interface, then adding a new method would cause a break in clients, because classes that implemented the interface would no longer compile.

This happens in Java periodically; for example, the JDBC Connection interface had a createBlob method added in Java 1.6 and a getSchema method added in Java 1.7. For clients that call the Connection class, the behavior remains the same, but for providers who must implement the class, the change requires more work.

Tip

When a client is a consumer of an interface, it should import up to the next major version number such as [1.2,2). When a client is a provider of an interface, it should import up to the next minor version [1.2,1.3). This allows consumers to accept new functionality but requires implementors to verify and rebuild when the minor version changes.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset