db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andreas Korneliussen <Andreas.Kornelius...@Sun.COM>
Subject Re: [jira] Updated: (DERBY-1146) Verify that JDBC4 signatures satisfied
Date Tue, 28 Mar 2006 11:50:10 GMT
This is very interesting.

However, isn't it the job of the compiler to figure out that the 
signatures of an interface has been implemented ?

I did the following change to EmbedResultSet40:

I added "implements java.sql.ResultSet" in the class definition. The 
compilation then failed with:

     [javac] 
/home/ak136785/devel/derbydev/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedResultSet40.java:33:

org.apache.derby.impl.jdbc.EmbedResultSet40 is not abstract and does not 
override abstract method 
updateNCharacterStream(java.lang.String,java.io.Reader,int) in 
java.sql.ResultSet
.. + warnings


The base class of EmbedResultSet40 also claims that it implements 
java.sql.ResultSet, however it is compiled against a previous jre 
version which does not have the new methods.  By declaring that the 
EmbedResultSet40 class implements java.sql.ResultSet, I make the 
compiler check that the class implements the interface when compiling it 
with the 1.6 jre.

I think it would be good for all EmbedXXX40 to declare which interface 
they are supposed to implement, and then the compiler will make sure 
that all signatures are satisfied.

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

Andreas



Knut Anders Hatlen (JIRA) wrote:
>      [ http://issues.apache.org/jira/browse/DERBY-1146?page=all ]
> 
> Knut Anders Hatlen updated DERBY-1146:
> --------------------------------------
> 
>     Attachment: client.txt
>                 embedded.txt
> 
> The test is not ready to be uploaded yet, but I thought I'd share the
> results I have found so far. The attached files embedded.txt and
> client.txt list all the methods that were missing or incorrect.
> 
> In the embedded driver, 58 methods are missing and one method has
> incorrect return value. The methods belong in these classes:
> 
> org.apache.derby.iapi.jdbc.BrokeredCallableStatement40
> org.apache.derby.iapi.jdbc.BrokeredConnection40
> org.apache.derby.iapi.jdbc.BrokeredPreparedStatement40
> org.apache.derby.iapi.jdbc.BrokeredStatement
> org.apache.derby.impl.jdbc.EmbedBlob
> org.apache.derby.impl.jdbc.EmbedCallableStatement40
> org.apache.derby.impl.jdbc.EmbedClob
> org.apache.derby.impl.jdbc.EmbedConnection40
> org.apache.derby.impl.jdbc.EmbedDatabaseMetaData40
> org.apache.derby.impl.jdbc.EmbedParameterMetaData30
> org.apache.derby.impl.jdbc.EmbedPreparedStatement40
> org.apache.derby.impl.jdbc.EmbedResultSet40
> org.apache.derby.impl.jdbc.EmbedResultSetMetaData
> org.apache.derby.impl.jdbc.EmbedStatement
> org.apache.derby.jdbc.EmbedPooledConnection
> org.apache.derby.jdbc.EmbedXAConnection
> org.apache.derby.jdbc.EmbeddedConnectionPoolDataSource
> org.apache.derby.jdbc.EmbeddedDataSource40
> org.apache.derby.jdbc.EmbeddedXADataSource
> 
> In the client driver, 54 methods are missing. The methods belong in
> these classes:
> 
> org.apache.derby.client.ClientXAConnection
> org.apache.derby.client.am.Blob
> org.apache.derby.client.am.CallableStatement40
> org.apache.derby.client.am.Clob
> org.apache.derby.client.am.ColumnMetaData
> org.apache.derby.client.am.LogicalConnection
> org.apache.derby.client.am.ParameterMetaData
> org.apache.derby.client.am.PreparedStatement40
> org.apache.derby.client.am.Statement
> org.apache.derby.client.net.NetConnection40
> org.apache.derby.client.net.NetDatabaseMetaData40
> org.apache.derby.client.net.NetResultSet40
> org.apache.derby.jdbc.ClientConnectionPoolDataSource
> org.apache.derby.jdbc.ClientDataSource40
> org.apache.derby.jdbc.ClientXADataSource
> 
>> Verify that JDBC4 signatures satisfied
>> --------------------------------------
>>
>>          Key: DERBY-1146
>>          URL: http://issues.apache.org/jira/browse/DERBY-1146
>>      Project: Derby
>>         Type: Improvement
>>   Components: JDBC, Test
>>     Versions: 10.2.0.0
>>     Reporter: Rick Hillegas
>>     Assignee: Knut Anders Hatlen
>>  Attachments: client.txt, embedded.txt
>>
>> Add to the jdbc40 suite a test which verifies that our JDBC4 classes satisfy the
expected class/interface signatures.
> 


Mime
View raw message