Anurag Shekhar wrote:


Also, I think this also indicates that we should consider using delegation instead of inheritance for code reuse.

Andreas

I didn't get it, how does it indicates that ?
anurag

Because now we are fooling the compiler to think that EmbedXXX40 classes implement java.sql.XXX interface since it inherits from a class which has declared that it implements it. The problem is that the base class is compiled against an old runtime library, and we lose the compile time checks for the new methods.

This way of doing things was not introduced as part of JDBC4, it also applies to JDBC3 vs JDBC2. So basically a developer may accidentally change the signature of a JDBC3 method, and the compiler will not complain. You will only detect the error in runtime, i.e through tests.

Andreas

Reply via email to