That method is implemented in the current driver version. You must be using an old PgJDBC. Upgrade. It’s fully backward compatible. (You should’ve specified your PgJDBC version in the question).
Separately, though, relying on connection “validation” is usually a bad idea. It’s just a way of trying to imperfectly hide a race condition. Simply grab the connection and use it. If there’s a problem with it, your application should trap the resulting exception, check the SQLSTATE
to see if it’s a connection related error, and retry with a new connection.