2012-01-20 17 views
1

java.sql.Connectionは、単体テストの詳細を取得するために冗長接続に実装されています。我々は のJava 1.5コンパイラーを使用する場合は、上記の方法を実装するjava 1.5とjava 1.6の間のjava.sql.Connectionの互換性の問題

The type VerboseConnection must implement the inherited abstract method Connection.createArrayOf(String, Object[]) 
    The type VerboseConnection must implement the inherited abstract method Connection.createBlob() 
    The type VerboseConnection must implement the inherited abstract method Connection.createClob() 
    The type VerboseConnection must implement the inherited abstract method Connection.createNClob() 
    The type VerboseConnection must implement the inherited abstract method Connection.createSQLXML() 
    The type VerboseConnection must implement the inherited abstract method Connection.createStruct(String, Object[]) 
    The type VerboseConnection must implement the inherited abstract method Connection.getClientInfo() 
    The type VerboseConnection must implement the inherited abstract method Connection.getClientInfo(String) 
    The type VerboseConnection must implement the inherited abstract method Connection.isValid(int) 
    The type VerboseConnection must implement the inherited abstract method Connection.setClientInfo(Properties) 
    The type VerboseConnection must implement the inherited abstract method Connection.setClientInfo(String, String) 
    The type VerboseConnection must implement the inherited abstract method Wrapper.isWrapperFor(Class) 
    The type VerboseConnection must implement the inherited abstract method Wrapper.unwrap(Class) 

は再び1.6で正常に動作します。しかし、次のコンパイルエラー

NClob cannot be resolved to a type 
    SQLClientInfoException cannot be resolved to a type 
    SQLClientInfoException cannot be resolved to a type 
    SQLXML cannot be resolved to a type 
    The import java.sql.NClob cannot be resolved 
    The import java.sql.SQLClientInfoException cannot be resolved 
    The import java.sql.SQLXML cannot be resolved 
での結果:コンパイルエラーを以下でJava 1.6コンパイラの結果を使用して

のバージョンで両方のバージョンで動作させる方法をお勧めします。

+0

1.6でコンパイルし、1.5で使用します。 –

答えて

1

Java 1.5とJava 1.6の両方の実装を提供する必要がある場合は、プロジェクトで抽象基本クラスを使用し、Javaバージョンに依存する実装を別のプロジェクトに追加できます。

Javaバージョンによっては、どちらか一方をコンパイルして、結果のクラスファイルをメインのjarファイルに含めます。

これは、Jaybird(Firebird JDBCドライバ)の実装で使用するアプローチです。

関連する問題