Tuesday, September 14, 2010

API compatibility

Today I was stumbling across in interesting page about what changes are allowed to an existing API without breaking compatibility to existing clients which I think is worth a read: http://wiki.eclipse.org/Evolving_Java-based_APIs_2 .

What surprised me was that adding/deleting checked exceptions to a method is not breaking binary compatibility. That means that clients compiled against the old API won't have problems to call the modified method.

Anyway, as soon as the exception is thrown the legacy client might behave unpredictable because of subsequent exceptions e.g. ClassNotFound or UndeclaredThrowable or things like that.