Check for new methods on Java SQL interfaces

In Java SE 6, a new java.sql.Wrapper superinterface was added to the following SQL interfaces:

This rule detects and flags Java classes that implement these interfaces if the classes do not have the Wrapper methods. Any class that implements these Java interfaces cannot compile until the Wrapper methods are added to the class.

In the following example, the MyClass class will be flagged until the isWrapperFor and unwrap methods are added:

public class MyClass implements javax.sql.DataSource {
	public Connection getConnection() throws SQLException {
		// TODO Auto-generated method stub
		return null;
	}

	public Connection getConnection(String username, String password)
			throws SQLException {
		// TODO Auto-generated method stub
		return null;
	}

	public PrintWriter getLogWriter() throws SQLException {
		// TODO Auto-generated method stub
		return null;
	}

	public void setLogWriter(PrintWriter out) throws SQLException {
		// TODO Auto-generated method stub
		
	}

	public void setLoginTimeout(int seconds) throws SQLException {
		// TODO Auto-generated method stub
		
	}

	public int getLoginTimeout() throws SQLException {
		// TODO Auto-generated method stub
		return 0;
	}
                            
}

To fix the problem, compile your application in Eclipse using Java 6 or higher. Use the automated fix to add the missing methods, then manually add the missing implementation. Copy the custom configuration to your application build file to enable the fix automation.

See the java.sql.Wrapper interface Java documentation for more information.