My understanding is that in order to maintain source-compatibility, Java never introduces new methods to public interfaces, as that breaks existing clients implementing the interfaces. [Java Release notes](http://java.sun.com/javase/6/webnotes/compatibility.html#source) states
> In general, the policy is as follows,
> except for any incompatibilities
> listed further below:
> - Maintenance releases (such as 1.4.1,
> 1.4.2) do not introduce any new language features or APIs. They will
> maintain source-compatibility with
> each other.
> - Functionality releases and major
> releases (such as 1.3.0, 1.4.0, 5.0)
> maintain upwards but not downwards
Yet, the packages `java.sql` and `javax.sql` continue to evolve and introduce many incompatible changes. For example, I noticed the following incompatible changes (introduced in Java 6):
- [`java.sql.Statement`](http://java.sun.com/javase/6/docs/api/java/sql/Statement.html) extends `java.sql.Wrapper`, requiring new two new methods.
- [`java.sql.Statement`](http://java.sun.com/javase/6/docs/api/java/sql/Statement.html) introduces 3 new methods
- [`java.sql.PreparedStatement`](http://java.sun.com/javase/6/docs/api/java/sql/PreparedStatement.html) introduces 19 new methods!
- [`java.sql.ResultSet`](http://java.sun.com/javase/6/docs/api/java/sql/ResultSet.html) introduces 48 new methods!
Do you know how and why these methods got added? Is `java.sql` being treated differently from the rest of the platform? Do you know of the discussion/JSR around these additions? Adding methods does not break upwards compatibility, only downwards (which is allowed for major releases, like Java 6).
以上就是Java 6 Source backward-compatibility and SQL的详细内容，更多请关注web前端其它相关文章！