Java 6 source backward compatibility and SQL

My understanding is that in order to maintain source compatibility, Java never introduces new methods into the public interface, because it will destroy the existing clients that implement the interface Java release notes status

However, Java SQL and javax The SQL package continues to evolve and introduces many incompatible changes For example, I noticed the following incompatible changes (introduced in Java 6):

> java. sql. Statement extension Java sql. Wrapper, two new methods are needed. > java. sql. Statement introduces three new methods > java sql. Preparedstatement introduces 19 new methods! > java. sql. Resultset introduces 48 new methods!

Do you know how to add these methods? java. How is SQL handled different from the rest of the platform? Do you know these added discussions / jsrs?

Solution

I got the following reply from sun developers

The general evolution strategy for API in JDK is functional versions such as JDK 7

>Do not destroy binary compatibility (as defined in Chapter 13 of jlsv3) and avoid introducing source incompatibility > manage behavior compatibility changes

(for more, see

"Kings of compatibility: source, binary, and behavioral" and "compatible evolving BigDecimal"

Adding a method to an interface is binary compatible, but source incompatible, so it is not normal In general, the more widely the interface is implemented, the less likely we are to add methods The JDBC region is an exception to this strategy and uses more relaxed upgrade rules, but it will cause real problems when users want to upgrade to a new version of the JDK

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>