2014-04-25 70 views
0

我想覆蓋scala中的dbcp BasicDataSource類,但我感到困惑的編譯器輸出。如果我試圖做到以下幾點:覆蓋Scala中的BasicDataSource

class MyBasicDataSource extends BasicDataSource { 

} 

我得到以下編譯器錯誤:

class MyBasicDataSource needs to be abstract, since: it has 3 unimplemented members. /** As seen from class MyBasicDataSource, the missing signatures are 
as follows. * For convenience, these are usable as stub implementations. */ // Members declared in javax.sql.CommonDataSource def getParentLogger(): 
java.util.logging.Logger = ??? // Members declared in java.sql.Wrapper def isWrapperFor(x$1: Class[_]): Boolean = ??? def unwrap[T](x$1: Class[T]): T = ??? 

但我可以實例化一個新的BasicDataSource:

val ds = new BasicDataSource 

,所以它不是一個抽象的類。我也可以在沒有任何編譯器錯誤的情況下在java中覆蓋它。有人可以向我解釋爲什麼我得到這些編譯器錯誤?

感謝 德

+0

可能scala編譯器運行在jdk7上並且java編譯器在jdk6上運行? – Luciano

+0

它們都配置爲在jdk7上運行。爲什麼這可能是一個問題? – user79074

+1

你使用的是commons-dbcp 2.0嗎? – Luciano

回答

0

問題是,我是用DBCP 1.4和Java 7的不兼容。升級到dbcp 2.0並修復它