Thank you all for your quick answers. It has been very helpful to understand that Eclipse uses different compiler, that explained a lot.
As for my problem - I assumed that Java compiler is right and that the build actually had errors. On closer examination, it occured to be the incompatibility of an older version of Apache Commons DBCP with Java 1.6. I was sure I was using the latest one and consulted wrong documentation version, which stated that the required methods were implemented.
Now as for Eclipse. The bug is actually tricky. I managed to write a test case showing this bug. I use Java 1.6 and Eclipse Helios for Java EE. I created a Java project in Eclipse and added
com.springsource.org.apache.commons.pool-1.5.3.jar
com.springsource.org.apache.commons.dbcp-1.2.2.osgi.jar
to the classpath (downloaded these JARs from SpringSource repository). As you see, Apache Commons DBCP is an old one. Java 1.6 requres version 1.4+.
In my test project I extend org.apache.commons.dbcp.BasicDataSource and additionally said it should implement javax.sql.DataSource. Like this:
import org.apache.commons.dbcp.BasicDataSource;
import javax.sql.DataSource;
public class MyDataSource extends BasicDataSource implements DataSource {
}
The tricky part here is that BasicDataSource implements DataSource interface. But in version 1.6 this interface got extended it, so the new methods are not implemented. Adding "implements DataSource" again explicitly should cause and error, which Java compiler successfully reports. But Eclipse compiles this code without any warning and it even runs.
So that was the problem. Seems like a bug in Eclipse to me.