我的项目是使用JDK 1.5编译的。我使用了一个实现方法java.sql.Driver
的接口getParentLogger
:
import java.util.logging.Logger;
...
public interface Driver {
...
public Logger getParentLogger() throws SQLFeatureNotSupportedException;
}
我的班级MockDriver
实现了这个界面:
import org.apache.log4j.Logger;
...
class MockDriver implements Driver {
...
public Logger getParentLogger() {
return LOGGER;
}
}
就像那样,当我编译时,它对我有用。
但是在我的项目中使用JDK 1.8时,我有一个错误:
error: MockDriver is not abstract and does not override abstract method
getParentLogger() in Driver
error: getParentLogger() in MockDriver cannot implement getParentLogger() in
Driver
return type org.apache.log4j.Logger is not compatible with
java.util.logging.Logger
有什么想法吗?